Coder Social home page Coder Social logo

smv-tnishikawa / rxkingfisher Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rxswiftcommunity/rxkingfisher

0.0 0.0 0.0 1.05 MB

Reactive extension for the Kingfisher image downloading and caching library

License: MIT License

Swift 84.96% Ruby 11.44% Shell 3.59%

rxkingfisher's Introduction

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 by Resource or Source

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

optionSelected // Observable<Resource> or Observable<Source>
    .bind(to: image.kf.rx.image(options: [.transition(.fade(0.2))])
    .disposed(by: disposeBag)

OR

optionSelected // Observable<Resource> or Observable<Source>    
    .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)

Refer

URL is implementing Resource (See Kingfisher.Resource.swift)

Retrieve an Image without an Image View

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

tappedButton
    .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.

rxkingfisher's People

Contributors

freak4pc avatar bigmotor avatar tokijh avatar kasyanov-ms avatar ronkliffer avatar ppth0608 avatar bluesource avatar smv-tnishikawa avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.