diff --git a/apple/OmnivoreKit/Sources/Views/FeedItem/GridCard.swift b/apple/OmnivoreKit/Sources/Views/FeedItem/GridCard.swift index 1e8e46254..2cb04ca89 100644 --- a/apple/OmnivoreKit/Sources/Views/FeedItem/GridCard.swift +++ b/apple/OmnivoreKit/Sources/Views/FeedItem/GridCard.swift @@ -133,19 +133,19 @@ public struct GridCard: View { Spacer() if let imageURL = item.imageURL { - AsyncLoadingImage(url: imageURL) { imageStatus in - if case let AsyncImageStatus.loaded(image) = imageStatus { + AsyncImage(url: imageURL) { phase in + if let image = phase.image { image .resizable() .aspectRatio(contentMode: .fill) .frame(width: geo.size.width / 3, height: (geo.size.width * 2) / 9) .cornerRadius(3) - } else if case AsyncImageStatus.loading = imageStatus { + } else if phase.error != nil { + EmptyView() + } else { Color.appButtonBackground .frame(width: geo.size.width / 3, height: (geo.size.width * 2) / 9) .cornerRadius(3) - } else { - EmptyView() } } } diff --git a/apple/OmnivoreKit/Sources/Views/FeedItem/HomeFeedCardView.swift b/apple/OmnivoreKit/Sources/Views/FeedItem/HomeFeedCardView.swift index f7515393c..daac1fc81 100644 --- a/apple/OmnivoreKit/Sources/Views/FeedItem/HomeFeedCardView.swift +++ b/apple/OmnivoreKit/Sources/Views/FeedItem/HomeFeedCardView.swift @@ -47,19 +47,19 @@ public struct FeedCard: View { Group { if let imageURL = item.imageURL { - AsyncLoadingImage(url: imageURL) { imageStatus in - if case let AsyncImageStatus.loaded(image) = imageStatus { + AsyncImage(url: imageURL) { phase in + if let image = phase.image { image .resizable() .aspectRatio(contentMode: .fill) .frame(width: 80, height: 80) .cornerRadius(6) - } else if case AsyncImageStatus.loading = imageStatus { + } else if phase.error != nil { + EmptyView().frame(width: 80, height: 80, alignment: .top) + } else { Color.appButtonBackground .frame(width: 80, height: 80) .cornerRadius(6) - } else { - EmptyView().frame(width: 80, height: 80, alignment: .top) } } } diff --git a/apple/OmnivoreKit/Sources/Views/ProfileCard.swift b/apple/OmnivoreKit/Sources/Views/ProfileCard.swift index 61583e480..9e923a560 100644 --- a/apple/OmnivoreKit/Sources/Views/ProfileCard.swift +++ b/apple/OmnivoreKit/Sources/Views/ProfileCard.swift @@ -22,18 +22,11 @@ public struct ProfileCard: View { public var body: some View { HStack(alignment: .center) { Group { - if let url = data.imageURL { - AsyncLoadingImage(url: url) { imageStatus in - if case let AsyncImageStatus.loaded(image) = imageStatus { - image.resizable() - } else { - Image(systemName: "person.crop.circle").resizable() - } - } - } else { - Image(systemName: "person.crop.circle") - .resizable() - } + AsyncImage( + url: data.imageURL, + content: { $0.resizable() }, + placeholder: { Image(systemName: "person.crop.circle").resizable() } + ) } .aspectRatio(contentMode: .fill) .frame(width: 70, height: 70, alignment: .center)