Last active
November 7, 2021 20:33
-
-
Save dimkagithub/28369c04ff8e46ec691b7410b1b7f63f to your computer and use it in GitHub Desktop.
UserDefaults
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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