Swiftpack.co - Mobelux/ImageFetcher as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by Mobelux.
Mobelux/ImageFetcher 1.1.4
Fetch images from the Web.
⭐️ 0
🕓 4 hours ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/Mobelux/ImageFetcher.git", from: "1.1.4")


ImageFetcher is lightweight image loading library build on top of OperationQueue. It is optimizes for scroll view performance by decompressing images in the background and exposing a configuration option for rounding corners of the image.

📱 Requirements

Swift 5.1x toolchain with Swift Package Manager, iOS 12

🖥 Installation

📦 Swift Package Manager (recommended)

Add ImageFetcher to your Packages.swift file:

.package(url: "https://github.com/Mobelux/ImageFetcher.git", from: "1.0.0"),

⚙️ Usage

Intialize ImageFetcher with a Cache:

let fetcher = try ImageFetcher(DiskCache(storageType: .temporary(nil)))

Optionally initialize with a queue and maximum concurrent download count:

let fetcher = try ImageFetcher(DiskCache(storageType: .temporary(nil)), queue: OperationQueue(), maxConcurrent: 5)

To fetch an image from the web:

let config = ImageConfiguration(url: URL(string: "https://via.placeholder.com/150")!)
fetcher.load(config) { result in
    switch result {
    case .success(let imageResult):
        let image = imageResult.value
    default: break

Fetch an image with configuration options and robust handling:

let config = ImageConfiguration(url: URL(string: "https://via.placeholder.com/150")!,
                                size: CGSize(width: 100.0, height: 100.0),
                                constrain: true,
                                cornerRadius: 10.0,
                                scale: 1)
fetcher.load(config) { result in
    switch result {
    case .success(let imageResult):
        switch imageResult {
        case .cached(let image):
            /// handle image coming from cache
        case .downloaded(let image):
            /// handle newly downloaded image
    case .failure(let error):
        /// handle error


ImageFetcher is release under MIT licensing.


Stars: 0
Last commit: 4 hours ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.


Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics