65

GitHub - onevcat/Kingfisher: A lightweight, pure-Swift library for downloading a...

 6 years ago
source link: https://github.com/onevcat/Kingfisher
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md

Kingfisher

68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6f6e65766361742f4b696e676669736865722f6d61737465722e737667 68747470733a2f2f696d672e736869656c64732e696f2f62616467652f43617274686167652d636f6d70617469626c652d3442433531442e7376673f7374796c653d666c6174 68747470733a2f2f696d672e736869656c64732e696f2f636f636f61706f64732f762f4b696e676669736865722e7376673f7374796c653d666c6174 68747470733a2f2f696d672e736869656c64732e696f2f636f636f61706f64732f6c2f4b696e676669736865722e7376673f7374796c653d666c6174 68747470733a2f2f696d672e736869656c64732e696f2f636f636f61706f64732f702f4b696e676669736865722e7376673f7374796c653d666c6174 codebeat badge 68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f4b696e676669736865722f6261636b6572732f62616467652e737667 68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f4b696e676669736865722f73706f6e736f72732f62616467652e737667

Kingfisher is a lightweight, pure-Swift library for downloading and caching images from the web. This project is heavily inspired by the popular SDWebImage. It provides you a chance to use a pure-Swift alternative in your next app.

Features

  • Asynchronous image downloading and caching.
  • URLSession-based networking. Basic image processors and filters supplied.
  • Multiple-layer cache for both memory and disk.
  • Cancelable downloading and processing tasks to improve performance.
  • Independent components. Use the downloader or caching system separately as you need.
  • Prefetching images and showing them from cache later when necessary.
  • Extensions for UIImageView, NSImage and UIButton to directly set an image from a URL.
  • Built-in transition animation when setting images.
  • Customizable placeholder while loading images.
  • Extensible image processing and image format support.

The simplest use-case is setting an image to an image view with the UIImageView extension:

let url = URL(string: "url_of_your_image")
imageView.kf.setImage(with: url)

Kingfisher will download the image from url, send it to both the memory cache and the disk cache, and display it in imageView. When you use the same code later, the image will be retrieved from cache and shown immediately.

Requirements

  • iOS 8.0+ / macOS 10.10+ / tvOS 9.0+ / watchOS 2.0+
  • Swift 4 (Kingfisher 4.x), Swift 3 (Kingfisher 3.x)

Main development of Kingfisher is based on Swift 4. Only critical bug fixes will be applied to Kingfisher 3.x.

  • Kingfisher 4.0 Migration - Kingfisher 3.x should be source compatible to Kingfisher 4. The reason for a major update is that we need to specify the Swift version explicitly for Xcode. All deprecated methods in Kingfisher 3 has been removed, so please ensure you have no warning left before you migrate from Kingfisher 3 to Kingfisher 4. If you have any trouble in migrating, please open an issue to discuss.
  • Kingfisher 3.0 Migration Guide - If you are upgrading to Kingfisher 3.x from an earlier version, please read this for more information.

Next Steps

We prepared a wiki page. You can find tons of useful things there.

  • Installation Guide - Follow it to integrate Kingfisher into your project.
  • Cheat Sheet- Curious about what Kingfisher could do and how would it look like when used in your project? See this page for useful code snippets. If you are already familiar with Kingfisher, you could also learn new tricks to improve the way you use Kingfisher!
  • API Reference - Lastly, please remember to read the full whenever you may need a more detailed reference.

Other

Future of Kingfisher

I want to keep Kingfisher lightweight. This framework will focus on providing a simple solution for downloading and caching images. This doesn’t mean the framework can’t be improved. Kingfisher is far from perfect, so necessary and useful updates will be made to make it better.

Developments and Tests

Any contributing and pull requests are warmly welcome. However, before you plan to implement some features or try to fix an uncertain issue, it is recommended to open a discussion first.

The test images are contained in another project to keep this project repo fast and slim. You could run ./setup.sh in the root folder of Kingfisher to clone the test images when you need to run the tests target. It would be appreciated if your pull requests could build and with all tests green. :)

About the logo

The logo of Kingfisher is inspired by Tangram (七巧板), a dissection puzzle consisting of seven flat shapes from China. I believe she's a kingfisher bird instead of a swift, but someone insists that she is a pigeon. I guess I should give her a name. Hi, guys, do you have any suggestions?

Contact

Follow and contact me on Twitter or Sina Weibo. If you find an issue, just open a ticket. Pull requests are warmly welcome as well.

Contributors

This project exists thanks to all the people who contribute. [Contribute]. 68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f6b696e676669736865722f636f6e7472696275746f72732e7376673f77696474683d383930

Backers

Thank you to all our backers! ? [Become a backer]

68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f6b696e676669736865722f6261636b6572732e7376673f77696474683d383930

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f6b696e676669736865722f73706f6e736f722f302f6176617461722e737667 68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f6b696e676669736865722f73706f6e736f722f312f6176617461722e737667 68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f6b696e676669736865722f73706f6e736f722f322f6176617461722e737667 68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f6b696e676669736865722f73706f6e736f722f332f6176617461722e737667 68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f6b696e676669736865722f73706f6e736f722f342f6176617461722e737667 68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f6b696e676669736865722f73706f6e736f722f352f6176617461722e737667 68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f6b696e676669736865722f73706f6e736f722f362f6176617461722e737667 68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f6b696e676669736865722f73706f6e736f722f372f6176617461722e737667 68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f6b696e676669736865722f73706f6e736f722f382f6176617461722e737667 68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f6b696e676669736865722f73706f6e736f722f392f6176617461722e737667

License

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


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK