To run the example project, clone the repo, and run pod install
from the Example directory first.
To install it, simply add the following line to your Podfile:
pod "CarambaKit"
pod "CarambaKit/Networking"
pod "CarambaKit/Persistence"
let request = RequestBuilder(baseUrl: "https://api.apps.com").get("/users").withParameters(["param": "value"]).build()
let client = JsonHttpClient()
client.request(request).subscribeNext { response in
// :tada:
}
- Create an entity that conforms the protocol
Oauth2Entity
implementing the required methods. - Create an instance of the handler passing the defined entity and the delegate of the handler.
- Connect the
Webview
delegate with the handler using the methodshouldRedirectUrl
. - Call
start
on the handler to start the Oauth2 flow. - 🎉
Fetch, store, and clear a session from the Keychain:
let repository = SessionRepository(name: "idonethis")
let session = repository.fetch()
UserDefaultsObservable
allows you to observe changes in the user defauls under a given key.
- Create an instance of the observable passing the key you're insterented in.
- Hold a reference to that observable, otherwise the subscription will be removed.
- Get the Rx observable and subscribe to it.
self.observable = UserDefaultsObservable(key: "user")
self.observable.rx().subscribeNext { newValue in
print("New value: \(newValue)")
}
- Pedro Piñera Buendía, [email protected]
- Sergi Gracia, [email protected]
- Isaac Roldán, [email protected]
CarambaKit is available under the MIT license. See the LICENSE file for more info.