I'm trying to get UserDefaults working in Xcode8/Swift 3, but keep getting the following error:
Type 'UserDefaults' has no member 'standard'
My code:
let defaults = UserDefaults.standard
defaults.set("value", forKey: "myKey")
You can add namespace to fix it:
let defaults = Foundation.UserDefaults.standard
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With