You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 1, 2022. It is now read-only.
First of all, let me start by saying, thank you for creating such a great package. It has greatly simplified our image loading and caching, something that we wish Apple offered out of the box.
When running the app on an iOS 15 device, we have discovered that even if the image has already been loaded, our placeholder view will always be shown before displaying the cached image. When the view reappears, the placeholder will be shown for a brief moment before the cached image is loaded in. This creates the effect that the image is being loaded again, however I have confirmed that there is no network activity. It appears to be something to do with the fact that the image has an animation added to it.
Example code:
LazyImage(source: url) { state in
if let image = state.image {
image
.aspectRatio(contentMode: .fit)
} else {
generic
.aspectRatio(contentMode: .fit)
}
}
.frame(height: targetHeight)
.animation(.easeIn)
.clipShape(Circle()))
Putting a breakpoint in the content closure shows that it is initially called with a nil value for state.image, before almost immediately being called again with a non-nil image. This results in the behaviour I described above.
When removing the animation, it works as expected. The above code works fine running on iOS 14, using the same build. We are building using Xcode 12.5.1, and I have also confirmed that this issue is present when building using Xcode 13.
I suspect that this may be something to do with changes to the way SwiftUI handles animations, but I thought I'd point it out here nonetheless in case it is something you need to look into.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hello there,
First of all, let me start by saying, thank you for creating such a great package. It has greatly simplified our image loading and caching, something that we wish Apple offered out of the box.
When running the app on an iOS 15 device, we have discovered that even if the image has already been loaded, our placeholder view will always be shown before displaying the cached image. When the view reappears, the placeholder will be shown for a brief moment before the cached image is loaded in. This creates the effect that the image is being loaded again, however I have confirmed that there is no network activity. It appears to be something to do with the fact that the image has an animation added to it.
Example code:
Putting a breakpoint in the content closure shows that it is initially called with a
nil
value forstate.image
, before almost immediately being called again with a non-nil
image. This results in the behaviour I described above.When removing the animation, it works as expected. The above code works fine running on iOS 14, using the same build. We are building using Xcode 12.5.1, and I have also confirmed that this issue is present when building using Xcode 13.
I suspect that this may be something to do with changes to the way SwiftUI handles animations, but I thought I'd point it out here nonetheless in case it is something you need to look into.
The text was updated successfully, but these errors were encountered: