Latest 0.1.7
Homepage https://github.com/shimesaba9/SwiftDefaults
License MIT
Platforms ios 8.0, requires ARC
Authors

CI Status
Version
License
Platform

Description

SwiftDefaults provides accessing to NSUserDefaults using property.

import SwiftDefaults

class MyDefaults: SwiftDefaults {
    dynamic var value: String? = "10"
    dynamic var value2: String = "10"
    dynamic var value3: Int = 1
    dynamic var value4: Person? = nil
}

print(MyDefaults().value2)
MyDefaults().value2 = "2"
print(MyDefaults().value2)

print("Stored person instance: (MyDefaults().value4)")
let p = Person()
p.firstName = "Elvis"
p.lastName = "Presley"
p.age = 42
MyDefaults().value4 = p
print("Stored person instance: (MyDefaults().value4)")
MyDefaults().value4 = nil
print("Stored nil person: (MyDefaults().value4)")

Usage

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

Installation

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

pod "SwiftDefaults"

Author

shimesaba9, @shimesaba43

License

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

Latest podspec

{
    "name": "SwiftDefaults",
    "version": "0.1.7",
    "summary": "SwiftDefaults provides accessing to NSUserDefaults using property.",
    "description": "SwiftDefaults provides accessing to NSUserDefaults using property.nn```swiftnimport SwiftDefaultsnnclass MyDefaults: SwiftDefaults {n    dynamic var value: String? = "10"n    dynamic var value2: String = "10"n    dynamic var value3: Int = 1n}nnprint(MyDefaults().value) // "10"nprint(MyDefaults().value2) // "10"nMyDefaults().value2 = "2"nprint(MyDefaults().value2) // "2"n```",
    "homepage": "https://github.com/shimesaba9/SwiftDefaults",
    "license": "MIT",
    "authors": {
        "shimesaba9": "[email protected]"
    },
    "source": {
        "git": "https://github.com/shimesaba9/SwiftDefaults.git",
        "tag": "0.1.7"
    },
    "social_media_url": "https://twitter.com/shimesaba43",
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "swift_version": "5.0",
    "source_files": "Pod/Classes/**/*"
}

Pin It on Pinterest

Share This