Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/coldgrub1384/objectuserdefaults
An object oriented and clean wrapper UserDefaults.
https://github.com/coldgrub1384/objectuserdefaults
ios macos swift tvos userdefaults watchos
Last synced: about 2 months ago
JSON representation
An object oriented and clean wrapper UserDefaults.
- Host: GitHub
- URL: https://github.com/coldgrub1384/objectuserdefaults
- Owner: ColdGrub1384
- License: mit
- Created: 2018-09-05T23:02:58.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-11-25T16:52:08.000Z (about 6 years ago)
- Last Synced: 2024-03-15T04:21:53.808Z (9 months ago)
- Topics: ios, macos, swift, tvos, userdefaults, watchos
- Language: Swift
- Homepage: https://coldgrub1384.github.io/ObjectUserDefaults
- Size: 467 KB
- Stars: 16
- Watchers: 8
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ObjectUserDefaults
![Pod](https://cocoapod-badges.herokuapp.com/v/ObjectUserDefaults/badge.png) ![Platforms](https://cocoapod-badges.herokuapp.com/p/ObjectUserDefaults/badge.png) [![Language](https://img.shields.io/badge/Language-Swift-orange.svg)](https://swift.org) [![License](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/ColdGrub1384/ObjectUserDefaults/blob/master/LICENSE)
An object oriented `UserDefaults`.
`UserDefaults` uses methods to get values and set values with given keys, but you have to pass keys as parameters each time you want to set or get a value. With `ObjectUserDefaults`, each item in stored in `UserDefaults` is represented by an object and its value can be set and gotten trough that. That's mean that instead of storing keys in constant, you can store direct references to items.
## Usage
```swift
import ObjectUserDefaultslet item = ObjectUserDefaults.standard.item(forKey: "Key") // Creates a reference to the key "Key"
print(item.value) // Prints the value of the key
item.value = true // Sets the value of the key
print(item.boolValue) // Prints the boolean value of the key
```## Installation
### Cocoapods
`pod 'ObjectUserDefaults'`
### Manual
Copy this repo to yours or add it as submodule, drag the xcode project to your one and embed the framework in your target's info tab.
## Documentation
See the docs [here](https://coldgrub1384.github.io/ObjectUserDefaults)