Joseph Astrahan
Joseph Astrahan

Reputation: 9072

UIDevice.currentDevice().identifierForVendor!.UUIDString Swift 3 migration

I have the following code in swift 2

let deviceid = UIDevice.currentDevice().identifierForVendor!.UUIDString

This fails to compile. I tried following suggestions from the auto-fix in xCode and I came up with this.

 let deviceid = UIDevice.currentDevice.identifierForVendor!.UUIDString

However it still does not compile. It says value of type 'UUID' has no member UUIDString'

Upvotes: 3

Views: 4332

Answers (1)

Damo
Damo

Reputation: 12890

My advice - for these kind of issues - get straight into a playground

let deviceid = UIDevice.current.identifierForVendor?.uuidString

Playground xCode 8

Upvotes: 7

Related Questions