I current have a set of asynchronous functions that are both called in the viewDidLoad()
. At the end of each function is a bool that is set from false to true u
Another approach using DispatchGroup. More simple, imho.
class ViewController: UIViewController {
let group = DispatchGroup()
override func viewDidLoad() {
super.viewDidLoad()
group.enter()
functionOne()
group.enter()
functionTwo()
group.notify(queue: .global(qos: .default), execute: { [weak self] in
self?.functionThree()
})
}
func functionOne() {
//async stuff
group.leave()
}
func functionTwo() {
//async stuff
group.leave()
}
func functionThree() {
//stuff
}
}