#LDMLightweightStore
[![CI Status](http://img.shields.io/travis/Lobanov Dmitry/LDMLightweightStore.svg?style=flat)](https://travis-ci.org/Lobanov Dmitry/LDMLightweightStore)
This is a lightweight key-value store which could be useful if you have several settings in app and you don't know where you should place them
##Requirements iOS 7 or later
##Features
- Easy to use
- Convenience setup
###What implemented?
- in-Memory dictionary store
- Defaults store
- Keychain store ( UICKeyChainStore inside )
- Policy switching (move your data between stores)
##Installation To install project use CocoaPods. (Recommended)
####CocoaPods
You can use CocoaPods.
pod 'LDMLightweightStore'
##Usage
###Import
Import store into your project, just add
#import<LDMLightweightStore/LDMLightweightStore.h>
###Examples
Suppose, that you have sensitive data or settings. Suppose, that you need a device id that you generated by yourself or you need first-user-install option.
Let's see example:
# put device id
NSString *deviceId = @"deviceId"; // please, use not so obvious name, of course.
// setup store in memory
LDMLightweightStore *store =
[LDMLightweightStore storeWithPolicy:LDMLightweightStorePolicyMemory options:@{LDMLightweightStoreOptionsStoreScopeNameKey: @"app_settings", LDMLightweightStoreOptionsAllFieldsArrayKey: deviceId}];
[store setField:deviceId byValue:@"YOUR_DEVICE_ID"];
// and if you go to release:
[store switchPolicy:LDMLightweightStorePolicyDefaults];
// or more long-live:
[store switchPolicy:LDMLightweightStorePolicyKeychain];
[store tearDown]; // cleanup store
[store setField:deviceId byValue:nil]; // cleanup value for field +deviceId+
LDMLightweightStore *newStore = [store switchPolicy:LDMLightweightStorePolicyDefaults];
LDMLightweightStore *newStore = [store switchPolicy:LDMLightweightStorePolicyKeychain];
##Contact Dmitry Lobanov http://github.com/lolgear
##Licene LDMLightweightStore is available under the MIT License. See the License file for more info.