I have a TimeInterval
I had to turn it into a String
so it could be added to the Dictionary
that gets passed from Apple Watch to iPhone via WatchConnectivity
.
Now that I have the String
on the iPhone, I need to turn it back into a TimeInterval
, but I can't seem to figure that out.
(I need to display this in a UILabel
that shows the duration of the workout session.)
Any ideas?
For Example
Watch:
00:15:15 (hours, minutes, seconds) turns into "915.012948989868"
let myDouble = computeDurationOfWorkout(withEvents: hkWorkout?.workoutEvents, startDate: hkWorkout?.startDate, endDate: hkWorkout?.endDate)
let myDoubleString = String(myDouble)
durationVariableString = myDoubleString
iPhone:
Need to turn "915.012948989868" back into 00:15:15