swift - Altering Stepper values to work as time values? -
i want have stepper used add minutes timer. stepper outputs + or - 1 default, using *60 make minute, makes timer display total number of seconds in timer rather minutes. e.g. pressing twice reads 120 in time rather 02:00, how convert this?
@ibaction func reststeppervaluechanged(_ sender: uistepper) { numberofrestlabel.text = int(sender.value).description restcount = int(sender.value)*60 restremainingcountdownlabel.text = string(restcount) }
this?
let seconds = restcount % 60 let minutes = (restcount / 60) % 60 let result = "\(minutes):\(seconds)" print(result)
Comments
Post a Comment