Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UUID in Swift iOS 8.1

Tags:

ios

swift

I have a problem when i try to change my App to iOS 8.1. The Syntax to create a UUID doesent work anymore:

var uuid = NSUUID.UUID().UUIDString

How to create a uuid in iOS 8.1 with Swift?

like image 416
derdida Avatar asked Dec 25 '22 03:12

derdida


1 Answers

Swift 3:

var uuid = NSUUID().uuidString
print("UUID string: \(uuid)") // UUID string: D7C7F26B-608A-465A-ADF8-4F5365513E5D

Swift 2:

var uuid = NSUUID().UUIDString
println("UUID string: \(uuid)") // UUID string: 76A4073A-D79C-45FD-A5D6-86E52AD8C771
like image 136
zaph Avatar answered Jan 12 '23 06:01

zaph