All Projects → trivago → ReactiveHeimdall

trivago / ReactiveHeimdall

Licence: Apache-2.0 license
Reactive wrapper around Heimdall.swift

Programming Languages

swift
15916 projects
shell
77523 projects
ruby
36898 projects - #4 most used programming language
objective c
16641 projects - #2 most used programming language
Makefile
30231 projects

ReactiveHeimdall

ReactiveHeimdall is a ReactiveCocoa-based extension to Heimdallr.swift.

Installation

Installation is possible via Carthage or CocoaPods, see below for either method:

Carthage

Carthage is a simple, decentralized dependency manager for Cocoa.

  1. Add ReactiveHeimdall to your Cartfile:
github "trivago/ReactiveHeimdall" ~> 2.0
  1. Run carthage update to fetch and build Heimdall and its dependencies.

  2. Make sure your application's target links against ReactiveHeimdall.framework and copies all relevant frameworks into its application bundle (iOS); or embeds the binaries of all relevant frameworks (Mac).

CocoaPods

  1. Add ReactiveHeimdall to your Podfile:

    pod 'ReactiveHeimdall', :git => 'https://github.com/trivago/ReactiveHeimdall.git', :tag => '2.0'
  2. Run pod install to fetch and build ReactiveHeimdall and its dependencies.

Usage

When requesting an access token the signal completes on success

let signal = heimdall.requestAccessToken("foo", password: "bar")
signal.subscribeCompleted {
    // access token has been aquired
}
signal.subscribeError { error in
    // access token could not be acquired
}

When authenticating a request the signal sends the authenticated request and completes on success

let signal = heimdall.authenticateRequest(NSURLRequest(URL: NSURL(string: "http://www.trivago.com/foobar")!))
signal.subscribeNext { value in
    let request = value as? NSURLRequest // request is the authenticated `NSURLRequest`
}
signal.subscribeError { error in
    // request could not be authorized
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].