Skip to content

ReactiveSwift JSON parsing helpers for Swift 4 JSON decoding.

License

Notifications You must be signed in to change notification settings

wieweb/ReactiveCodable

 
 

Repository files navigation

ReactiveCodable

Swift 4.0 Platform

ReactiveSwift JSON parsing helpers for Swift 4 JSON decoding. Inspired by: ReactiveMapper

Usage

ReactiveSwift

ReactiveCodable supports JSON mapping for ReactiveSwift on values in a Signal or SignalProducer stream.

// Create model from a JSON dictionary
let jsonSignalProducer: SignalProducer<Data, NSError> = // ...
jsonSignalProducer.mapToType(User.self).startWithResult { result in
    // use the decoded User model
    let user: User? = result.value
}

// Create array of models from array of JSON dictionaries
let jsonSignalProducer: SignalProducer<Any, NSError> = // ...
jsonSignalProducer.mapToType([Task].self).startWithResult { result in
    // use the decoded array of Task models
    let tasks: [Task]? = result.value
}

Version Compatibility

Current Swift compatibility breakdown:

Swift Version Framework Version
4.x 1.x

Installation

Carthage

Add the following line to your Cartfile.

github "gunterhager/ReactiveCodable"

Then run carthage update.

About

ReactiveSwift JSON parsing helpers for Swift 4 JSON decoding.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 94.3%
  • Objective-C 5.7%