Skip to content

Instantly share code, notes, and snippets.

@mgrebenets
Created March 10, 2018 11:02
Show Gist options
  • Save mgrebenets/0f51d4036a48ca31f1178f14aab66e65 to your computer and use it in GitHub Desktop.
Save mgrebenets/0f51d4036a48ca31f1178f14aab66e65 to your computer and use it in GitHub Desktop.
Async Swift Scripting - 8
import Alamofire
var keepAlive = true
Alamofire.request("http://httpbin.org/get")
.responseJSON { response in
print(response) // Result of response serialization
keepAlive = false
}
let runLoop = NSRunLoop.currentRunLoop()
while keepAlive &&
runLoop.runMode(NSDefaultRunLoopMode, beforeDate: NSDate(timeIntervalSinceNow: 0.1)) {
// Run, run, run
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment