Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/morishin/betteruserdefaults

UserDefaults Swift Extensions
https://github.com/morishin/betteruserdefaults

ios swift

Last synced: 23 days ago
JSON representation

UserDefaults Swift Extensions

Awesome Lists containing this project

README

        

# BetterUserDefaults

![Swift version](https://img.shields.io/badge/swift-4.0-orange.svg)
![CocoaPods compatible](https://cocoapod-badges.herokuapp.com/v/BetterUserDefaults/badge.png)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)

UserDefaults Swift Extensions

## Usage
```swift
import BetterUserDefaults

extension UserDefaults.Key {
static let sampleKeyA = UserDefaults.Key("sampleKeyA")
static let sampleKeyB = UserDefaults.Key("sampleKeyB")
}

UserDefaults.standard.set(true, for: .sampleKeyA)
UserDefaults.standard.set(123, for: .sampleKeyB)

UserDefaults.standard.bool(for: .sampleKeyA) // true
UserDefaults.standard.integer(for: .sampleKeyB) // 123
```

## Installation
### Carthage
Cartfile

```
github "morishin/BetterUserDefaults"
```

### CocoaPods
Podfile

```ruby
pod 'BetterUserDefaults'
```

## LICENSE
MIT