I am new to coding. I am trying to learn iOS development and I have created a simple countdown timer, that uses a slider to select the amount of time in seconds. I would like to add a tone to the final 9 secs of the countdown. I know how to add audio files, but I have "NO IDEA" how to add a countdown tone to the last 9 seconds of the timer.
@IBAction func startBtnTapped(_ sender: Any) {
timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(ViewController.counter), userInfo: nil, repeats: true)
SoundPlayer4.play()
//Hide Start and Slider Buttons
startBtn.isHidden = true
sliderCtrl.isHidden = true
stopBtn.isHidden = false
}
@IBAction func stopBtnTapped(_ sender: Any) {
timer.invalidate()
seconds = 180
sliderCtrl.setValue(180, animated: true)
timerLbl.text = "180"
SoundPlayer3.play()
//Show Start and Slider Buttons
sliderCtrl.isHidden = false
startBtn.isHidden = false
stopBtn.isHidden = true
}
@IBAction func sliderCrtlUsed(_ sender: UISlider) {
seconds = Int(sender.value)
timerLbl.text = String(seconds)
}
func counter(){
seconds -= 1
timerLbl.text = String(seconds)
if (seconds == 0){
timer.invalidate()
//Show Start and Slider Buttons
startBtn.isHidden = false
sliderCtrl.isHidden = false
stopBtn.isHidden = true
//Play Audio
SoundPlayer1.play()
}
}
So can anyone help me add a countdown tone to my project? Thank you