Created
February 25, 2016 21:05
-
-
Save CaptainMalReynolds/489ce2648b524fcc7e8b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension NSUserDefaults { | |
@nonobjc subscript(key: String) -> AnyObject? { | |
get { | |
return objectForKey(key) | |
} | |
set { | |
setObject(newValue, forKey: key) | |
} | |
} | |
@nonobjc subscript(key: String) -> Bool { | |
get { | |
return boolForKey(key) | |
} | |
set { | |
setBool(newValue, forKey: key) | |
} | |
} | |
// etc. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment