Here is the logic
let diff : TimeInterval = Date().timeIntervalSince1970 - capturedStartTimeSecs
let remaining : TimeInterval = capturedStartTimeSecs - diff;
let minutes : TimeInterval = remaining / 60;
var mins : String = String(Int(minutes)) + "";
if(Int(minutes) < 10){
mins = "0" + String(Int(minutes));
}
var seconds = remaining
seconds.formTruncatingRemainder(dividingBy:60) ;
var secs : String = String(Int(seconds)) + "";
if(Int(seconds) < 10){
secs = "0" + String(Int(seconds))
}
let diff : TimeInterval = Date().timeIntervalSince1970 - capturedStartTimeSecs
let remaining : TimeInterval = capturedStartTimeSecs - diff;
let minutes : TimeInterval = remaining / 60;
var mins : String = String(Int(minutes)) + "";
if(Int(minutes) < 10){
mins = "0" + String(Int(minutes));
}
var seconds = remaining
seconds.formTruncatingRemainder(dividingBy:60) ;
var secs : String = String(Int(seconds)) + "";
if(Int(seconds) < 10){
secs = "0" + String(Int(seconds))
}
No comments:
Post a Comment