I have been using this function to generate a time stamp. I found it somewhere here on Stack Overflow.
@objc public class var timestamp: String {
return
Your code will crash on all 32-bit platforms (such as iPhone 4, 5) because the result of
NSDate().timeIntervalSince1970 * 1000
// E.g.: 1464850525047.38
does not fit into a 32-bit integer. As a solution, use 64-bit integers:
Int64(NSDate().timeIntervalSince1970 * 1000)
Alternatively, if the intention is to create a string representing the milliseconds, use string formatting instead of an integer conversion:
String(format:"%.0f", NSDate().timeIntervalSince1970 * 1000)