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
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
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.
To run the example project, clone the repo, and run pod install
from the Example directory first.
KikBank is available through CocoaPods. To install it, simply add the following line to your Podfile:
'KikBank'
James Harquail, ragnar@kik.com
KikBank is available under the MIT license. See the LICENSE file for more info.