Progressive concurrent image downloader for SwiftUI BindingObject, with neat API and performant LRU mem/disk cache.
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.
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()
)
}
}
}
}