Tutorial by Examples

Say you want to perform in action (in this case, logging "Foo"), while doing something else (logging "Bar"). Normally, if you don't use concurrency, one of these actions is going to be fully executed, and the other run will run only after it's completely finished. But with concur...
When performing tasks asynchronously there typically becomes a need to ensure a piece of code is run on the main thread. For example you may want to hit a REST API asynchronously, but put the result in a UILabel on the screen. Before updating the UILabel you must ensure that your code is run on th...
dispatch_group_t preapreWaitingGroup = dispatch_group_create(); dispatch_group_enter(preapreWaitingGroup); [self doAsynchronousTaskWithComplete:^(id someResults, NSError *error) { // Notify that this task has been completed. dispatch_group_leave(preapreWaitingGroup); }] dispatch...

Page 1 of 1