Skip to content

modo-studio/CarambaKit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
Pedro Piñera Buendía
Aug 12, 2016
d231205 · Aug 12, 2016

History

84 Commits
Jul 31, 2016
Aug 10, 2016
Aug 12, 2016
Jul 27, 2016
Aug 10, 2016
Jul 31, 2016
Aug 12, 2016
Jul 27, 2016
Aug 12, 2016
Jul 28, 2016
Aug 12, 2016
Aug 12, 2016
Jul 11, 2016
Aug 12, 2016
Jul 11, 2016

Repository files navigation

CarambaKit

CI Status codecov Dependency Status

Example

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

Requirements

Installation

To install it, simply add the following line to your Podfile:

pod "CarambaKit"
pod "CarambaKit/Networking"
pod "CarambaKit/Persistence"

CarambaKit

Networking

let request = RequestBuilder(baseUrl: "https://api.apps.com").get("/users").withParameters(["param": "value"]).build()
let client = JsonHttpClient()
client.request(request).subscribeNext { response in
  // :tada:
}

Oauth2

  1. Create an entity that conforms the protocol Oauth2Entity implementing the required methods.
  2. Create an instance of the handler passing the defined entity and the delegate of the handler.
  3. Connect the Webview delegate with the handler using the method shouldRedirectUrl.
  4. Call start on the handler to start the Oauth2 flow.
  5. 🎉

SessionRepository

Fetch, store, and clear a session from the Keychain:

let repository = SessionRepository(name: "idonethis")
let session = repository.fetch()

Persistence

UserDefaultsObservable

UserDefaultsObservable allows you to observe changes in the user defauls under a given key.

  1. Create an instance of the observable passing the key you're insterented in.
  2. Hold a reference to that observable, otherwise the subscription will be removed.
  3. Get the Rx observable and subscribe to it.
self.observable = UserDefaultsObservable(key: "user")
self.observable.rx().subscribeNext { newValue in
  print("New value: \(newValue)")
}

Author

License

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