Nuke
Nuke copied to clipboard
Images disappear when scrolling a list back and forth (SwiftUI)
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
}