Generate a UUID on iOS from Swift

前端 未结 6 1751
一向
一向 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:11

    For Swift 3, many Foundation types have dropped the 'NS' prefix, so you'd access it by UUID().uuidString.

提交回复
热议问题