Question : swift wait until condition is true
Answered by : lmaocoder
//You can use a Timer
//You have to import Foundation first though
let timer = Timer.scheduledTimer(withTimeInterval: 5.0, repeats: false) { (timer) in //Code to run
}
//This makes it so that the code inside of the timer runs 5 seconds after loading, and it does not repeat
//More examples to be found at source, this is just one that I sort of prefer
Source : https://www.zerotoappstore.com/create-a-delay-or-wait-in-swift.html | Last Update : Sat, 21 Aug 21