Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/muukii/OneStore
πA single value proxy for NSUserDefaults, with clean API.
https://github.com/muukii/OneStore
ios store userdefaults
Last synced: 3 months ago
JSON representation
πA single value proxy for NSUserDefaults, with clean API.
- Host: GitHub
- URL: https://github.com/muukii/OneStore
- Owner: muukii
- License: mit
- Archived: true
- Created: 2016-08-22T18:28:33.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-02-01T15:39:14.000Z (about 3 years ago)
- Last Synced: 2024-04-27T10:02:44.643Z (10 months ago)
- Topics: ios, store, userdefaults
- Language: Swift
- Homepage:
- Size: 71.3 KB
- Stars: 27
- Watchers: 2
- Forks: 7
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ios - OneStore - A single value proxy for NSUserDefaults, with clean API. (Database / Getting Started)
- awesome-ios-star - OneStore - A single value proxy for NSUserDefaults, with clean API. (Database / Getting Started)
- fucking-awesome-ios - OneStore - A single value proxy for NSUserDefaults, with clean API. (Database / Getting Started)
- fucking-awesome-ios - OneStore - A single value proxy for NSUserDefaults, with clean API. (Database / Getting Started)
README
# OneStore
[](https://travis-ci.org/muukii/OneStore)
[](http://cocoapods.org/pods/OneStore)
[](http://cocoapods.org/pods/OneStore)
[](http://cocoapods.org/pods/OneStore)
[](https://github.com/Carthage/Carthage)A single value proxy for NSUserDefaults, with clean API.
With OneStoreβ¦
- Create one proxy(an `OneStore` object) for each NSUserDefaults value.
- Multiple NSUserDefaults and namespaces are supported with `Stacks`.## Example
**Basic**
```swift
let name = OneStore("name")
let age = OneStore("age")name.value = "muukii"
age.value = 18
```**Specify Stack**
```swift
let stack = Stack(userDefaults: NSUserDefaults(suiteName: "group.me.muukii.Fil")!, namespace: "me")
let name = OneStore("name", stack: stack)
let age = OneStore("age", stack: stack)name.value = "muukii"
age.value = 18
```**Remove object**
```swift
let name = OneStore("name", stack: stack)
name.value = nil
```**Remove all objects on namespace**
```swift
let stack = Stack(userDefaults: NSUserDefaults.standardUserDefaults(), namespace: "me")
let name = OneStore("name", stack: stack)stack.removeAllObjectsOnNamespace()
/* or */
name.stack.removeAllObjectsOnNamespace()
```**Realworld example**
```swift
enum Me {
static let name = OneStore("name", stack: Me.stack)
static let age = OneStore("age", stack: Me.stack)private static let stack = Stack(userDefaults: NSUserDefaults.standardUserDefaults(), namespace: "me")
}Me.name.value = "muukii"
```## Requirements
Swift 3.0
## Installation
OneStore is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:```ruby
pod "OneStore"
```## Author
muukii, [email protected]
## License
OneStore is available under the MIT license. See the LICENSE file for more info.