Created
November 28, 2019 16:47
-
-
Save michaelrockhold/1bf15afb752543e59aa422ca1092abd1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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