I would like a for in loop to send off a bunch of network requests to firebase, then pass the data to a new view controller once the the...
When using GCD, we want to wait until two async blocks are executed and done before moving on to the next steps of execution. What is the best way...
In my app I have a function that makes an NSRURLSession and sends out an NSURLRequest using sesh.dataTaskWithRequest(req, completionHandler: {(data, response, error) In the completion block for this task,...
I have lots of code in Swift 2.x (or even 1.x) projects that looks like this: // Move to a background thread to do some long running work dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,...
I have a callback which might come from any thread. When I get this callback, then I would like to perform a certain task on the main thread. Do...
If you can target iOS 4.0 or above Using GCD, is it the best way to create singleton in Objective-C (thread safe)? + (instancetype)sharedInstance { static dispatch_once_t once; static...
In Swift 2, I was able to create queue with the following code: let concurrentQueue = dispatch_queue_create("com.swift3.imageQueue", DISPATCH_QUEUE_CONCURRENT) But this doesn’t compile in Swift 3. What is the preferred...
In Swift 2, I was able to use dispatch_after to delay an action using grand central dispatch: var dispatchTime: dispatch_time_t = dispatch_time(DISPATCH_TIME_NOW, Int64(0.1 * Double(NSEC_PER_SEC))) dispatch_after(dispatchTime, dispatch_get_main_queue(), { //...
I’m learning about concurrent programming for iOS. So far I’ve read about NSOperation/NSOperationQueue and GCD. What are the reasons for using NSOperationQueue over GCD and vice versa? Sounds like...
I’ve gone through the iBook from Apple, and couldn’t find any definition of it: Can someone explain the structure of dispatch_after? dispatch_after(<#when: dispatch_time_t#>, <#queue: dispatch_queue_t?#>, <#block: dispatch_block_t?#>) 26 s...