delay/sleep in Swift is not working
问题 I have a problem with the sleep function in Swift code. I'm using import Darwin and usleep(400000) . Some actions before reaching the sleep are blocked and I dont know why. Here a short example from my code: @IBAction func Antwort4Button(_ sender: Any) { if (richtigeAntwort == "4"){ Antwort4.backgroundColor = UIColor.green Ende.text = "Richtig!" NaechsteFrage() } else { Ende.text = "Falsch!" //NaechsteFrage() } } func NaechsteFrage() { usleep(400000) Antwort1.backgroundColor = UIColor.red