In my application, I am saving a key using this code:
func saveKey(){
var xmineSpillere = mineSpillere
var defaults = NSUserDefaults.standardUserDefaults()
defaults.setObject(xmineSpillere, forKey: "YourKey")
}
But how can I check if the key exists? I want the code something like this:
if key("YourKey") exists {
println("key exists")
}
else {
println("does not exist")
}
How can I do something like this in Swift?
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