I have just started learning iOS programming. Like as AsyncTask in android what is equivalent in iOS.
Asked
Active
Viewed 1,186 times
0
-
Check this question http://stackoverflow.com/questions/37801370/how-do-i-dispatch-sync-dispatch-async-dispatch-after-etc-in-swift-3 hope it helps you. – Ashish Kakkad Oct 24 '16 at 06:13
3 Answers
0
There is no exact equivalent, but you have several possibilities to execute code in parallel: e. g. Grand Central Dispatch, NSOperationQueue, and other.

clemens
- 16,716
- 11
- 50
- 65
-
can't we execute code serially second one gets started only when first gets complete.. – user2273146 Oct 24 '16 at 06:17
-
@user2273146 Yes you can, you can create a serial or a concurrent queue – Ahmad F Oct 24 '16 at 06:30
0
Actually, there more than just one concurrency technique for working with iOS, but I suggest to read about the GCD (Grand Central Dispatch) world.
Working with DispatchQueues is very easy now (after releasing Swift 3), you can check this answer to know how you can simply create one.
Also, you might want to check NSOperationQueue.
If you are interested, check Choosing Between NSOperation and Grand Central Dispatch.
Hope this helped.
0
The simplest/quickest solution in Swift 3.0 is:
DispatchQueue.main.async {
// your code goes here
}
That executes your code on the main thread asynchronously.

Robert King
- 1
- 1