Skip to content

Instantly share code, notes, and snippets.

@michaelrockhold
Created November 28, 2019 16:47
Show Gist options
  • Save michaelrockhold/1bf15afb752543e59aa422ca1092abd1 to your computer and use it in GitHub Desktop.
Save michaelrockhold/1bf15afb752543e59aa422ca1092abd1 to your computer and use it in GitHub Desktop.
import Foundation
func waitAroundThenReturn(continuation: @escaping ()->Void) {
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
continuation()
}
}
print("Hello, World!")
let curr = CFRunLoopGetCurrent()
waitAroundThenReturn {
print("I waited")
CFRunLoopStop(curr)
}
CFRunLoopRun();
print("Now I'm done")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment