conversion from NSTimeInterval to hour,minutes,seconds,milliseconds in swift
Swift supports remainder calculations on floating-point numbers, so we can use % 1. var ms = Int((interval % 1) * 1000) as in: func stringFromTimeInterval(interval: TimeInterval) -> NSString { let ti = NSInteger(interval) let ms = Int((interval % 1) * 1000) let seconds = ti % 60 let minutes = (ti / 60) % 60 … Read more