Skip to content

Instantly share code, notes, and snippets.

@Akhrameev
Created August 28, 2020 07:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Akhrameev/5d64fd92ea23b37b66fc9b4851043519 to your computer and use it in GitHub Desktop.
Save Akhrameev/5d64fd92ea23b37b66fc9b4851043519 to your computer and use it in GitHub Desktop.
class UDvars {
var AppLaunch: Int = UserDefaults.standard.object(forKey: "AppLaunch") as? Int ?? 0 {
didSet {
UserDefaults.standard.set(AppLaunch, forKey: "AppLaunch")
}
}
var Bool: Bool = UserDefaults.standard.object(forKey: "Bool") as? Bool ?? false {
didSet {
UserDefaults.standard.set(Bool, forKey: "Bool")
}
}
var String: String = UserDefaults.standard.object(forKey: "String") as? String ?? "" {
didSet {
UserDefaults.standard.set(String, forKey: "String")
}
}
}
let GlobalVars = UDvars()
@Akhrameev
Copy link
Author

synchronize is not necessary now. See release notes and header, that mentions that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment