In my application, I save the key using this code:
func saveKey(){ var xmineSpillere = mineSpillere var defaults = NSUserDefaults.standardUserDefaults() defaults.setObject(xmineSpillere, forKey: "YourKey") }
But how can I check if a key exists? I want the code to look something like this:
if key("YourKey") exists { println("key exists") } else { println("does not exist") }
How can I do something like this in Swift?
swift nsuserdefaults
Eri-sklii
source share