Skip to content

Instantly share code, notes, and snippets.

@efremidze
Created August 18, 2016 23:46
Show Gist options
  • Save efremidze/1cdbe611cdbb26c1d3686f54e175026d to your computer and use it in GitHub Desktop.
Save efremidze/1cdbe611cdbb26c1d3686f54e175026d to your computer and use it in GitHub Desktop.
optional variable assignment with default value
var UUID: String? {
return keychain[Constants.Keychain.UUID.description] ?? {
let string = UIDevice.currentDevice().identifierForVendor?.UUIDString
keychain[Constants.Keychain.UUID.description] = string
return string
}()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment