Created
October 28, 2014 16:10
-
-
Save radex/8833993186729399184d to your computer and use it in GitHub Desktop.
Nested struct with static constants inside of a class is a neat way of managing magic string constants, like identifiers, user defaults or other dictionary keys, etc…
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
class Foo { | |
struct Keys { | |
static let keychainGroup = "com.foo.keychain-group" | |
static let enabled = "foo.enabled" | |
} | |
// now you can just write `Keys.enabled`, `Keys.keychainGroup` inside of the Foo class. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment