WrappedValue 0.1.8

WrappedValue 0.1.8

Maintained by Callum Trounce.



  • By
  • cmtrounce

WrappedValue

CI Status Version License Platform

Intro

Forget the struggle of having to manually parse Strings to Ints, Doubles and other data types!

Using the power of Codable, WrappedValue will automatically decode them for you, with some life-changing error handling.

Basic Usage

typealias WrappedInt = WrappedValue<Int>

struct Person: Codable {
  let age: WrappedInt
  let name: String
}

If your JSON API returns age as String "30", WrappedValue will handle the parsing of it to an Int as specified in the typealias

Access the Int through person.age.value.

In addition to Codable, WrappedValue also conforms to Hashable, Equatable and Numeric

Example

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

Requirements

WrappedValue is compiled using Swift 4.2 in Xcode 10.

Installation

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

pod 'WrappedValue'

Author

cmtrounce, [email protected]

License

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