HomeiOS Developmentios - AsyncImage inside checklist is consuming a number of reminiscence when...

ios – AsyncImage inside checklist is consuming a number of reminiscence when scrolling and finally crash in SwiftUI


Here’s what I’ve carried out: the app crashes when the reminiscence goes over 1 GB or extra. I attempted commenting asyncImage, and it took solely 25–30 MB of reminiscence and did not crash.

Record {
            ForEach(0..<(self.imageURLArray.depend), id: .self) { i in
                AsyncImage(url: URL(string: self.imageURLArray[i])) { picture in
                    picture.resizable()
                        .aspectRatio(16/9, contentMode: .match)
                        .cornerRadius(10, antialiased: true)
                        .padding(.horizontal)
                        .padding(.vertical, 5)
                }
                placeholder: {
                    ZStack {
                        RoundedRectangle(cornerRadius: 10)
                            .foregroundColor(.black.opacity(0.1))
                            .aspectRatio(16/9, contentMode: .match)
                            .padding(.horizontal)
                            .padding(.vertical, 10)
                        ProgressView()
                            .progressViewStyle(.round)
                    }
                }
                .onAppear {
                    if self.imageURLArray[i] == self.imageURLArray.final {
                        self.loadMoreItems()
                    }
                }
            }
            .listRowInsets(EdgeInsets())
        }

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments