I\'m familiar with using AsyncTask
in Android: create a subclass, call execute
on an instance of the subclass and onPostExecute
is cal
In Android when I wanted to run a task on a background thread and then update the UI when it finished, I used AsyncTask
(example). Now when I am making iOS versions of my apps, I use Grand Central Dispatch (GCD) to do the same thing. Here is how it is done with Swift:
DispatchQueue.global(qos: .background).async {
// code to be run on a background task
DispatchQueue.main.async {
// code to be run on the main thread after the background task is finished
}
}