[ADD] iOS 13 compatible AsyncImage implementation with cache

This commit is contained in:
Fabian Thies
2022-11-27 00:26:15 +01:00
committed by Joe Mattiello
parent d3e8473f45
commit 0dc7af5e51
8 changed files with 143 additions and 63 deletions

View File

@@ -7,6 +7,7 @@
//
import SwiftUI
import AsyncImage
struct AppIconView: View {
let iconUrl: URL?
@@ -16,7 +17,7 @@ struct AppIconView: View {
}
var body: some View {
if let iconUrl, #available(iOS 15.0, *) {
if let iconUrl {
AsyncImage(url: iconUrl) { image in
image
.resizable()
@@ -25,10 +26,6 @@ struct AppIconView: View {
}
.frame(width: size, height: size)
.clipShape(RoundedRectangle(cornerRadius: cornerRadius, style: .continuous))
} else {
RoundedRectangle(cornerRadius: cornerRadius, style: .continuous)
.background(Color.secondary)
.frame(width: size, height: size)
}
}
}