Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bithavoc/codablelocal
Extend UserDefaults to set and get methods that work with any Codable(Encodable & Decodable) conforming types
https://github.com/bithavoc/codablelocal
codable extensions ios json local macos persistence swift user-defaults
Last synced: about 2 months ago
JSON representation
Extend UserDefaults to set and get methods that work with any Codable(Encodable & Decodable) conforming types
- Host: GitHub
- URL: https://github.com/bithavoc/codablelocal
- Owner: bithavoc
- License: mit
- Created: 2019-11-02T15:29:09.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2019-11-02T15:49:32.000Z (about 5 years ago)
- Last Synced: 2024-11-11T10:23:19.868Z (about 2 months ago)
- Topics: codable, extensions, ios, json, local, macos, persistence, swift, user-defaults
- Language: Ruby
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CodableLocal
[![Version](https://img.shields.io/cocoapods/v/CodableLocal.svg?style=flat)](https://cocoapods.org/pods/CodableLocal)
[![License](https://img.shields.io/cocoapods/l/CodableLocal.svg?style=flat)](https://cocoapods.org/pods/CodableLocal)
[![Platform](https://img.shields.io/cocoapods/p/CodableLocal.svg?style=flat)](https://cocoapods.org/pods/CodableLocal)## Example
### `UserDefaults+Codable`
```swift
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](https://cocoapods.org). To install
it, simply add the following line to your Podfile:```ruby
pod 'CodableLocal'
```## Author
bithavoc, [email protected]
## License
CodableLocal is available under the MIT license. See the LICENSE file for more info.