/SwiftWebImage

🚀SwiftUI image downloader for BindingObject with performant LRU mem/disk cache.

Primary LanguageSwiftMIT LicenseMIT

SwiftWebImage

Swift Version Carthage compatible License Platform

Progressive concurrent image downloader for SwiftUI BindingObject, with neat API and performant LRU mem/disk cache.

Simple Usage

Just import SwiftWebImage and set url for SwiftImage:

import SwiftWebImage

var body: some View {
    List {
        ForEach(Feed.list.identified(by: \.id)) { feed in
            // Set `url` for `SwiftImage`
            SwiftImage(url: feed.imageUrl)
        }
    }
}                       

Framework will automatically load Image with @ObjectBinding data once download completes.

How to config ImageView?

Trailing config block of SwiftImage is used for underlying ImageView configuration:

var body: some View {
    List {
        ForEach(Feed.list.identified(by: \.id)) { feed in
            SwiftImage(url: feed.imageUrl) { imageView in
                AnyView(
                    imageView
                        .frame(height: 300)
                        .clipped()
                )
            }
        }
    }
}

Demo