RxHyperdrive 0.1.1

RxHyperdrive 0.1.1

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Sep 2015
SPMSupports SPM

Maintained by Kyle Fuller.


Downloads

Total304
Week0
Month0

Installs

Apps8
Test Targets1
powered by Segment

GitHub

Stars16
Watchers1
Forks2
Issues0
Contributors2
Pull Requests0

Code

Files2
LOCLines of Code 46


 
Depends on:
Hyperdrive~> 0.2.0
RxSwift= 2.0.0-alpha.3
 

RxSwift extensions for Hyperdrive, the generic Swift Web API client.

Usage

let hyperdrive = Hyperdrive()

RxHyperdrive adds extensions to Hyperdrive to provide an enter and request function that returns an observable.

hyperdrive.enter("https://polls.apiblueprint.org/")
  .subscribeNext { representor in
    // We've successfully connected and we have a representor
    // representing the APIs "root" resource.

    print(representor)
  }

Once we've got a representor representing the root resource, we can follow any available transitions such as a transition to the questions collection resource.

let questions = representor.transitions["questions"]

hyperdrive.request(questions)
  .subscribeNext { representor in
    print(representor)
  }

Using flatMap we can chain both of these operations together producing an observer of the questions resource.

hyperdrive.enter("https://polls.apiblueprint.org/")
  .flatMap { representor in
    hyperdrive.request(representor.transitions["questions"])
  }
  .subscribeNext { representor in
    print(representor)
  }

Installation

CocoaPods is the recommended way to add RxHyperdrive to your project.

pod 'RxHyperdrive'

License

RxHyperdrive is released under the MIT license. See LICENSE.