kikinteractive/KikBank-iOS

Name: KikBank-iOS

Owner: Kik Interactive

Description: null

Created: 2018-02-07 20:34:45.0

Updated: 2018-05-10 17:22:31.0

Pushed: 2018-05-11 19:39:35.0

Homepage: null

Size: 97

Language: Swift

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

KikBank

CI Status Version License Platform

Use

Currently KikBank offers basic fetch and cache mechanisms, with a few options on how the data is requested and stored.

After creating an instance of KikBank…

kikBank = KikBank()

provide the url the data can be found at, KikBank will return a Single observable that you can map or bind as needed.

url = URL(string: "https://placekitten.com/g/300/300")!
dataObservable = kikBank.data(with: url, options: KBRequestParameters())

ou can bind this to a UIImageView, etc.
Observable
.map { (data) -> UIImage? in
    return UIImage(data: data)
}
.asObservable()
.bind(to: imageView.rx.image)
.disposed(by: disposeBag)

The KBRequestParameters struct handles the fetch and cache types. By default, it will check in memory for a copy of the data, and then do a network request. You can change the KBReadPolicy and KBWritePolicy enums to force a network fetch, handle memory and disk storage, and more. Additionally, set the expiryDate property to invalidate the cached data after a set time.

TODO
Example

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

Installation

KikBank is available through CocoaPods. To install it, simply add the following line to your Podfile:

'KikBank'
Author

James Harquail, ragnar@kik.com

License

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


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.