Created
October 25, 2016 05:07
-
-
Save feighter09/bbebafaf6690056ac4733cc2286355f2 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
let defaults = Defaults() | |
let hasLoggedIn = true | |
defaults.save(true, forKey: .LoggedIn) | |
defaults.save(false, forKey: .NotificationsEnabled) | |
let regularOrder = Order(item: "Cold Brew", size: .Large) | |
let alternateOrder = Order(item: "Latte", size: .Small) | |
defaults.save(regularOrder) | |
defaults.save(alternateOrder, forKey: .Alternate) | |
class Defaults { | |
func save<T: DefaultConvertible>(toSave: T, forKey key: T.Key = .Default) { ... } | |
func fetch<T: DefaultConvertible>(type: T.Type, forKey key: T.Key = .Default) -> T? { ... } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment