Skip to content

Instantly share code, notes, and snippets.

@efremidze
Last active March 12, 2017 01:07
Show Gist options
  • Save efremidze/e65fc763a161a549b52a800289c30943 to your computer and use it in GitHub Desktop.
Save efremidze/e65fc763a161a549b52a800289c30943 to your computer and use it in GitHub Desktop.
protocol Storable {}
extension Storable {
var storedValue: Any? {
get { return UserDefaults.standard["value"] }
nonmutating set { UserDefaults.standard["value"] = newValue }
}
}
struct Storage: Storable {}
let storage = Storage()
storage.storedValue = "🐼"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment