Skip to content

Instantly share code, notes, and snippets.

@danielgomezrico
Last active August 29, 2015 14:14
Show Gist options
  • Save danielgomezrico/14a8b07a88b745a07f66 to your computer and use it in GitHub Desktop.
Save danielgomezrico/14a8b07a88b745a07f66 to your computer and use it in GitHub Desktop.
clearAll function for NSUserDefaults
extension NSUserDefaults {
func clearAll() {
let dictionary = self.dictionaryRepresentation()
for (item, value) in dictionary {
let key = item as String
removeObjectForKey(key)
}
self.synchronize()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment