CocoaPods trunk is moving to be read-only. Read more on the blog, there are 10 months to go.

SwiftDefaults 0.1.8

SwiftDefaults 0.1.8

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Sep 2020
SPMSupports SPM

Maintained by shimesaba.



SwiftDefaults

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.