Nuke icon indicating copy to clipboard operation
Nuke copied to clipboard

Images disappear when scrolling a list back and forth (SwiftUI)

Open mickey4u opened this issue 10 months ago • 0 comments

I am new to SwiftUI and NukeUI. I am trying to use NukeUI to cache images using the code below. Now the problem I am facing is when I scroll though the list of items and back the images disappear and only reappear when I click anywhere on the screen. Am I doing something wrong?

let imageUrl = security.tokenImageUrl!
      LazyImage(source: URL(string: imageUrl)){ state in
          if let image = state.image {
              image.aspectRatio(contentMode: .fill)
                  .clipShape(Circle())
                  .cornerRadius(5)
                  .padding(8)
          } else if state.error != nil {
              Circle().cornerRadius(5)
                  .foregroundColor(.red)
          } else {
              Circle().cornerRadius(5)
                  .foregroundColor(.green)
          }
      }
      .onCreated{ image in
      }

mickey4u avatar Aug 29 '23 12:08 mickey4u