In my iOS Swift app I want to generate random UUID ( GUID ) strings for use as a table key, and this snippet appears to work:
let uuid = CFUUIDCreateString(nil, CFUUIDCreate(nil))
Is this safe?
Or is there perhaps a better (recommended) approach?
Sommaire |
In my iOS Swift app I want to generate random UUID ( GUID ) strings for use as a table key, and this snippet appears to work:
let uuid = CFUUIDCreateString(nil, CFUUIDCreate(nil))
Is this safe?
Or is there perhaps a better (recommended) approach?
Try this one:
let uuid = NSUUID().UUIDString print(uuid)
Swift 3
let uuid = UUID().uuidString print(uuid)
License : cc by-sa 3.0
http://stackoverflow.com/questions/24428250/generate-a-uuid-on-ios-from-swift