onevcat/Kingfisher
onevcat/Kingfisher has 24,406 GitHub stars and 2,774 forks. GitHot measured +1 in 7 days. Last checked 2026-11-10 03:24 UTC. Last push 2026-11-03.
So werden diese Zahlen gemessen
Eine schlanke, vollständig in Swift geschriebene Bibliothek zum Herunterladen und Zwischenspeichern von Bildern aus dem Web.
What you can do
- Asynchronous image downloading and caching.
- Loading image from either URLSession-based networking or local provided data.
- Useful image processors and filters provided.
- Multiple-layer hybrid cache for both memory and disk.
Gemessener Sternzuwachs
- in 24h
- Aktualisierung verzögert
- in 7 days
- +1
- in 15 days
- Aktualisierung verzögert
- in 1 month
- Aktualisierung verzögert
Nettoänderungen in überlappenden Zeiträumen, keine Tagessummen. Fehlende Messwerte bleiben leer. Sterne zeigen Interesse, nicht Qualität.
README.md
Original
Kingfisher is a powerful, pure-Swift library for downloading and caching images from the web. It provides you a chance to use a pure-Swift way to work with remote images in your next app.
Features
- Asynchronous image downloading and caching.
- Loading image from either
URLSession-based networking or local provided data. - Useful image processors and filters provided.
- Multiple-layer hybrid cache for both memory and disk.
- Fine control on cache behavior. Customizable expiration date and size limit.
- Opt-in async cache probing in
KingfisherManagerto avoid blocking the caller thread on disk cache checks. - Cancelable downloading and auto-reusing previous downloaded content to improve performance.
- Independent components. Use the downloader, caching system, and image processors separately as you need.
- Prefetching images and showing them from the cache to boost your app.
- Extensions for
UIImageView,NSImageView,NSButton,UIButton,NSTextAttachment,WKInterfaceImage,TVMonogramViewandCPListItemto directly set an image from a URL. - Built-in transition animation when setting images.
- Customizable placeholder and indicator while loading images.
- Extensible image processing and image format easily.
- Low Data Mode support.
- SwiftUI support.
- Swift 6 & Swift Concurrency (strict mode) prepared.
- Load & cache for Live Photo.
Kingfisher 101
The simplest use-case is setting an image to an image view with the UIImageView extension:
import Kingfisher
let url = URL(string: "https://example.com/image.png")
imageView.kf.setImage(with: url)
Kingfisher will download the image from url, send it to both memory cache and disk cache, and display it in imageView.
When you set it with the same URL later, the image will be retrieved from the cache and shown immediately.
It also works if you use SwiftUI:
var body: some View {
KFImage(URL(string: "https://example.com/image.png")!)
}
A More Advanced Example
With the powerful options, you can do hard tasks with Kingfisher in a simple way. For example, the code below:
- Downloads a high-resolution image.
- Downsamples it to match the image view size.
- Makes it round cornered with a given radius.
- Shows a system indicator and a placeholder image while downloading.
- When prepared, it animates the small thumbnail image with a "fade in" effect.
- The original large image is also cached to disk for later use, to get rid of downloading it again in a detail view.
- A console log is printed when the task finishes, either for success or failure.
let url = URL(string: "https://example.com/high_resolution_image.png")
let processor = DownsamplingImageProcessor(size: imageView.bounds.size)
|> RoundCornerImageProcessor(cornerRadius: 20)
imageView.kf.indicatorType = .activity
imageView.kf.setImage(
with: url,
placeholder: UIImage(named: "placeholderImage"),
options: [
.processor(processor),
.scaleFactor(UIScreen.main.scale),
.transition(.fade(1)),
.cacheOriginalImage
])
{
result in
switch result {
case .success(let value):
print("Task done for: \(value.source.url?.absoluteString ?? "")")
case .failure(let error):
print("Job failed: \(error.localizedDescription)")
}
}
It is a common situation I can meet in my daily work. Think about how many lines you need to write without Kingfisher!
Method Chaining
If you are not a fan of the kf extension, you can also prefer to use the KF builder and chained the method
invocations. The code below is doing the same thing:
// Use `kf` extension
imageView.kf.setImage(
with: url,
placeholder: placeholderImage,
options: [
.processor(processor),
.loadDiskFileSynchronously,
.cacheOriginalImage,
.transition(.fade(0.25)),
.lowDataMode(.network(lowResolutionURL))
],
progressBlock: { receivedSize, totalSize in
// Progress updated
},
completionHandler: { result in
// Done
}
)
// Use `KF` builder
KF.url(url)
.placeholder(placeholderImage)
.setProcessor(processor)
.loadDiskFileSynchronously()
.cacheMemoryOnly()
.fade(duration: 0.25)
.lowDataModeSource(.network(lowResolutionURL))
.onProgress { receivedSize, totalSize in }
.onSuccess { result in }
.onFailure { error in }
.set(to: imageView)
And even better, if later you want to switch to SwiftUI, just change the KF above to KFImage, and you've done:
struct ContentView: View {
var body: some View {
KFImage.url(url)
.placeholder(placeholderImage)
.setProcessor(processor)
.loadDiskFileSynchronously()
.cacheMemoryOnly()
.fade(duration: 0.25)
.lowDataModeSource(.network(lowResolutionURL))
.onProgress { receivedSize, totalSize in }
.onSuccess { result in }
.onFailure { error in }
}
}
Requirements
Current development branch
- iOS 15.0+ / macOS 12.0+ / tvOS 15.0+ / watchOS 9.0+ / visionOS 1.0+
- Xcode 26.0+ / Swift 6.2+ compiler
Kingfisher 8.0
- (UIKit/AppKit) iOS 13.0+ / macOS 10.15+ / tvOS 13.0+ / watchOS 6.0+ / visionOS 1.0+
- (SwiftUI) iOS 14.0+ / macOS 11.0+ / tvOS 14.0+ / watchOS 7.0+ / visionOS 1.0+
- Swift 5.9+
Kingfisher 7.0
- (UIKit/AppKit) iOS 12.0+ / macOS 10.14+ / tvOS 12.0+ / watchOS 5.0+ / visionOS 1.0+
- (SwiftUI) iOS 14.0+ / macOS 11.0+ / tvOS 14.0+ / watchOS 7.0+ / visionOS 1.0+
- Swift 5.0+
Installation
Refer to one of the following tutorials to install and use the framework:
Alternatively, you can follow either of the methods below.
Swift Package Manager
- File > Swift Packages > Add Package Dependency
- Add
https://github.com/onevcat/Kingfisher.git - Select "Up to Next Major" with "8.0.0"
CocoaPods
[!IMPORTANT] CocoaPods trunk becomes read-only on December 2, 2026 (announcement). After that date, new Kingfisher versions cannot be published to CocoaPods. The versions that are already published keep resolving, but you will not get updates or security fixes through CocoaPods. Migrate to Swift Package Manager or the pre-built framework to stay on supported releases.
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '15.0'
use_frameworks!
target 'MyApp' do
pod 'Kingfisher', '~> 8.0'
end
Pre-built Framework
- Open the release page, download the latest version of Kingfisher from the assets section.
- Drag the
Kingfisher.xcframeworkinto your project and add it to the target (usually the app target). - Select your target, in the "General" Tab, find the "Frameworks, Libraries, and Embedded Content" section, set the
Embed Without Signingto Kingfisher.
Documentation
Check the documentation and tutorials:
Migrating
If you are using an even earlier version, see the guides below to know the steps for migrating.
Other
Future of Kingfisher
I want to keep Kingfisher lightweight. This framework focuses 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. It would be appreciated if your pull requests could build 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, open a ticket. Pull requests are warmly welcome as well.
Backers & Sponsors
Open-source projects cannot live long without your help. If you find Kingfisher to be useful, please consider supporting this project by becoming a sponsor. Your user icon or company logo shows up on my blog with a link to your home page.
Become a sponsor through GitHub Sponsors. :heart:
Special thanks to:
License
Kingfisher is released under the MIT license. See LICENSE for details.
Ähnliche Projekte entdecken
freeCodeCamp/freeCodeCamp
Die Open-Source-Codebasis und das Curriculum von freeCodeCamp.org. Lerne Mathematik, Programmierung und Informatik kostenlos.
458,987 Sternedonnemartin/system-design-primer
Lerne, Systeme im großen Maßstab zu entwerfen, und bereite dich auf das Systemdesign-Interview vor. Enthält Anki-Karteikarten.
377,573 Sternereact/react
Die Bibliothek für Web- und native Benutzeroberflächen.
252,468 Sternevuejs/vue
Dies ist das Repository für Vue 2. Das Repository für Vue 3 findest du unter https://github.com/vuejs/core
212,535 Sterne
