How do I convert an NSTimeInterval
value to NSData
?
You may also use NSKeyedArchiver
:
let time = NSTimeInterval(100)
let archivedTime = NSKeyedArchiver.archivedDataWithRootObject(time)
let unarchivedTime = NSKeyedUnarchiver.unarchiveObjectWithData(archivedTime) as! NSTimeInterval