What you want IMHO
@IBAction func didTapPreviousButton(_ sender: UIButton) {
currentTrack -= 1
if currentTrack < 0 {
currentTrack = (urlPlayerItems.count - 1) < 0 ? 0 : (urlPlayerItems.count - 1)
}
playTrack()
}
Correct replacing of POSTFIX as you have it (useless)
@IBAction func didTapPreviousButton(_ sender: UIButton) {
if currentTrack < 0 {
currentTrack -= 1
currentTrack = (urlPlayerItems.count - 1) < 0 ? 0 : (urlPlayerItems.count - 1)
}
playTrack()
}
3
solved How to convert ++ or — in Swift 3? [duplicate]