Post

Replies

Boosts

Views

Activity

Reply to AsyncImage - Cancelled Loading before View is Visible
For anyone still having this issue, I resolved it in my case, to remove the data url from the state and entirely set it again. This is the relevant part of my code. This so called Card is wrapped as stated before with ScrollView following by a LazyVStack. struct Card: View { var item: item @Binding var showImage: Bool @State var dataurl: URL? var body: some View { HStack{ if showImage{ if let image_url = item.image_urll{ if let url = URL(string: image_url){ AsyncImage(url: dataurl, content:{ result in result .resizable() .aspectRatio(contentMode: .fill) .frame(width: 100) .clipped() }, placeholder: { ProgressView() .frame(width: 100, height: 100) }).onDisappear { dataurl = nil } .onAppear{ dataurl = url } } } } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Feb ’25