Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.