Latest 1.0.0
Homepage https://github.com/banxi1988/EasyDefaults
License MIT
Platforms ios 8.0
Authors

CI Status
Version
License
Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

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

pod "EasyDefaults"

Usage Example

import EasyDefaults

struct  MWebSettings{
static var baseFont = Default<String>("baseFont", defaultValue:"Menlo")
static var baseFontSize = Default<Int>("baseFontSize", defaultValue:15)
static var lineSpacing = Default<Int>("lineSpacing", defaultValue: 1)
static var transNewLinesToBR = Default<Bool>("transNewLinesToBR", defaultValue: true)
static var enableTOC = Default<Bool>("enableTOC", defaultValue: false)
static var autoScrollingThresholdPercent = Default<Double>("autoScrollingThresholdPercent", defaultValue: 60.0)
static var someThresholdPercent = Default<Float>("someThresholdPercent", defaultValue: 50.0)

//
//expect(MWebSettings.baseFont.optionalValue)  == "Menlo"
//expect(MWebSettings.baseFontSize.value)  == 15
//expect(MWebSettings.enableTOC.value)  == false
//expect(MWebSettings.transNewLinesToBR.value) == true
//

static var avatarUrl = Default<URL>("avatar")
static var favoriteFruits = Default<[String]>("favoriteFruits")
static var favoriteNumbers = Default<[Int]>("favoriteNumbers")
static var secretData = Default<Data>("secretData")
static var lastUpdateDate = Default<Date>("lastUpdateDate")
static var dateArray = Default<[Date]>("dateArray")
static var dataArray = Default<[Data]>("dataArray")
static var importNamedDate = Default<[String:Date]>("importNamedDate")
static var cachedData = Default<[String:Data]>("cachedData")
}

Note
as for Double,Int,Float, and Bool it always return not Optional Value. even if you use optionalValue property.

Author

banxi1988, [email protected]

License

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

Latest podspec

{
    "name": "EasyDefaults",
    "version": "1.0.0",
    "summary": "A Mordern ,Safe, Easy, Swifty way to access your UserDefaults",
    "description": "A Mordern ,Safe,Easy, Swifty way to access your UserDefault.nBased on Swift 3, delerative style.",
    "homepage": "https://github.com/banxi1988/EasyDefaults",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "banxi1988": "[email protected]"
    },
    "source": {
        "git": "https://github.com/banxi1988/EasyDefaults.git",
        "tag": "1.0.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "EasyDefaults/Classes/**/*",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This