I got this error:
Binary operator '??' cannot be applied to operands of type 'String?' and 'UUID'
here:
Binary operator '??' cannot be applied to operands of type 'String?' and 'UUID'
Why? ?? is for optionals, not?
CodePudding user response:
String and UUID are not the same types, so they cannot be compared.
If you want to compare them, you could get the value of the UUID as a String using the UUID.uuidString property.
let x: String? = nil
let uuid = UUID()
let y: String = x ?? uuid.uuidString
CodePudding user response:
first, get device UDID as a String after that you can compare
let udid = UIDevice.current.identifierForVendor!.uuidString
