Skip to content

Instantly share code, notes, and snippets.

@dimkagithub
Last active November 7, 2021 20:33
Show Gist options
  • Save dimkagithub/28369c04ff8e46ec691b7410b1b7f63f to your computer and use it in GitHub Desktop.
Save dimkagithub/28369c04ff8e46ec691b7410b1b7f63f to your computer and use it in GitHub Desktop.
UserDefaults
private var variable: Bool {
get {
return UserDefaults.standard.bool(forKey: "variableKey")
}
set {
UserDefaults.standard.setValue(newValue, forKey: "variableKey")
UserDefaults.standard.synchronize()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment