New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
transaction: Transaction(animation: .easeInOut) does not appear to work #2
Comments
well, Github's code view leaves much to be desired lol. Hopefully this is more readable var body: some View {
GeometryReader { geo in
AsyncImage(
url: url,
transaction: Transaction(animation: .easeInOut)
) { phase in
switch phase {
case .empty:
Rectangle()
.fill(Color.gray1)
case let .success(image):
image.resizable()
.scaledToFill()
case .failure:
Rectangle()
.fill(Color.gray1)
@unknown default:
EmptyView()
}
}
.frame(width: geo.size.width, height: geo.size.height)
.clipped()
}
}
} |
Thanks! Checkout the new release. Can you tell me if it works? |
Updated to 1.2.0 but it didn't seem to change anything? |
Update: I dld a clean build and now it's having an effect. However it appears to be the phase transition instead of the transaction transition (EG: my easeinout renders after the image appears rather than easing into the image). |
Actually, I take it back. I just went back and compared with AsyncImage and they're matching (I made a bunch of other changes that changed behaviour in the meantime). So can confirm that this is now supported. Great job! |
Thank you! 🚀 |
Great job on this! I was having a huge problem with AsyncImage redownloading images in lazy stacks that this lib completely eliminates.
The one difference I noticed is that transaction animations don't appear to work. I had a nice ease animation with AsyncImage that does not trigger when I swap it with CachedAsyncImage. Here's my body
var body: some View { GeometryReader { geo in AsyncImage( url: url, transaction: Transaction(animation: .easeInOut) ) { phase in switch phase { case .empty: Rectangle() .fill(Color.gray1) case let .success(image): image.resizable() .scaledToFill() case .failure: Rectangle() .fill(Color.gray1) @unknown default: EmptyView() } } .frame(width: geo.size.width, height: geo.size.height) .clipped() } } }
The text was updated successfully, but these errors were encountered: