Skip to content

Extend UserDefaults to set and get methods that work with any Codable(Encodable & Decodable) conforming types

License

Notifications You must be signed in to change notification settings

bithavoc/CodableLocal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CodableLocal

Version License Platform

Example

UserDefaults+Codable

struct UserInfo : Codable {
  let userId: String
}

...

let defaults = UserDefaults.standard
try defaults.set(object: UserInfo(userId: "id1"), forKey: "current-user")
let info = try defaults.get(objectType: UserInfo.self, forKey: "current-user")

Requirements

  • Swift 5 or above

Installation

CodableLocal is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'CodableLocal'

Author

bithavoc, im@bithavoc.io

License

CodableLocal is available under the MIT license. See the LICENSE file for more info.

About

Extend UserDefaults to set and get methods that work with any Codable(Encodable & Decodable) conforming types

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published