RxSwiftCommunity/RxKingfisher

Name: RxKingfisher

Owner: RxSwift Community

Description: Reactive extension for the Kingfisher image downloading and caching library

Created: 2018-05-10 07:03:47.0

Updated: 2018-05-24 17:22:02.0

Pushed: 2018-05-21 14:23:04.0

Homepage: null

Size: 968

Language: Swift

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

RxKingfisher

RxKingfisher is a Reactive Extension for Kingfisher - a lightweight, pure-Swift library for downloading and caching images from the web.

RxKingfisher Example

It provides Reactive Extensions on top of Kingfisher's .kf namespace, via .kf.rx and introduces two main usages:

Bind URL to Image View

Every Image view supports two different options for binding a URL to an Image view.

onSelected // Observable<URL>
.bind(to: image.kf.rx.image(options: [.transition(.fade(0.2))])
.disposed(by: disposeBag)

OR

onSelected
.flatMap { url in imageView.kf.rx.setImage(with: url, options: [.transition(.fade(0.2))]) }
.subscribe(onNext: { image in
    print("Image successfully loaded and set on Image view: \(image)")
})
.disposed(by: disposeBag)
Retrieve an Image without an Image View

Every KingfisherManager supports fetching an image from a URL, returning a Single<Image>:

edButton
.flatMapLatest { KingfisherManager.shared.rx.retrieveImage(with: urlToImage) }
.subscribe(onNext: { image in
    print("Image successfully loaded: \(image)")
})
.disposed(by: disposeBag)
License

RxKingfisher is released under the MIT license. See LICENSE for details.


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.