I am trying to figure out on Google, but I cannot find "How to execute a method in background in Swift".
Is there something similar to
performsSelectorInBackground:
from Objective-C?
Thanks in advance!
I am trying to figure out on Google, but I cannot find "How to execute a method in background in Swift".
Is there something similar to
performsSelectorInBackground:
from Objective-C?
Thanks in advance!
Because Swift is statically typed, there actually aren't selectors you can call.
What you should be doing instead is Grand Central Dispatch (GCD):
dispatch_async(dispatch_get_main_queue()) {
// do your stuff here
}
Both NSOperation and Grand Central Dispatch (GCD) are available in Swift. I would start by reading Apple's GCD and NSOperationQueue documentation: