Skip to content

Instantly share code, notes, and snippets.

View randymarsh77's full-sized avatar

Matt Preucil randymarsh77

View GitHub Profile
@randymarsh77
randymarsh77 / Bonjour.swift
Created April 14, 2017 05:30
The Bonjour API
public class Bonjour
{
public static func Broadcast(_ settings: BroadcastSettings) -> Scope
public static func FindAll(_ settings: QuerySettings) -> Task<[NetService]>
public static func Resolve(_ service: NetService) -> Task<Void>
}
@randymarsh77
randymarsh77 / AsyncDemo2.swift
Created April 13, 2017 05:30
A trivial, useless example of async/await using Async that does something and returns something.
let Q1 = DispatchQueue(label: "DemoQueue1")
let Q2 = DispatchQueue(label: "DemoQueue2")
func demo() -> Task<Int> {
return async { (task: Task<Int>) in
var calculation = 0
Q2.async {
print("Doing some expensive calculation of universal truths...")
calculation = 42
print("Figured it all out, lets wake up.")
@randymarsh77
randymarsh77 / AsyncDemo1.swift
Created April 13, 2017 05:20
A trivial, useless example of async/await using Async
await (async {
print("Awaiting a task begins execution on the same thread.")
await (async {
print("So we can nest awaits without switching thread contexts.")
})
})

Keybase proof

I hereby claim:

  • I am randymarsh77 on github.
  • I am randymarsh (https://keybase.io/randymarsh) on keybase.
  • I have a public key whose fingerprint is 9E24 BCCC 304C 646D 015E FFBA 8E11 F590 3783 9CFA

To claim this, I am signing this object: