Generate a UUID on iOS from Swift

前端 未结 6 1745
一向
一向 2020-12-12 09:20

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 = CFUU         


        
6条回答
  •  执念已碎
    2020-12-12 10:03

    Also you can use it lowercase under below

    let uuid = NSUUID().UUIDString.lowercaseString
    print(uuid)
    

    Output

    68b696d7-320b-4402-a412-d9cee10fc6a3

    Thank you !

提交回复
热议问题