I am making an app that vibrates with customizable breaks in between. I have a slider that is numbered 0-50. And it rounds it to the closest integer then displays it in my label. I am now trying to execute the command:
@IBOutlet weak var amount: UILabel!
@IBAction func slider1(_ sender: UISlider) {
amount.text = String(Int(sender.value));
}
@IBAction func vibrator(_ sender: UISlider) {
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate)
(the wait goes here but I don't know how to add it)
}
also if possible in the wait command i want to divide the label value by 10. it doesn't have to be specifically the wait command, just something to delay it.
Thanks in advance!
This is the best way to do this:
In this example, the code inside the function runs after an amount of time declared here:
The 1.0 is the time in seconds to wait, essentially. I'm assuming from what you said, you'll want to change that bit of code to:
I hope this is the answer you were looking for!