Closed sjidkov closed 1 year ago
Good catch. Will have a fix in v2.1.1
And, is there some detail explaination about differences between @StateObject
vs @ObservedObject
? I previouslly assume that anything ObservableObject that created inside the View init method, should use @StateObject
(else use @ObservedObject
)
@sjidkov See video in : https://github.com/SDWebImage/SDWebImageSwiftUI/issues/232#issuecomment-1253801702
v2.2.0 released
Hello,
First I want to say thank you for SDWebImageSwiftUI.
I recently upgraded to 2.1.0 and found an issue. When AnimatedImage is initiated from Data it no longer updates on data changes.
I have a view set up like the example below. On 2.0.2 it works as expected. On 2.1.0 the view shows an empty image even though avatarImageData loads correctly.
Furthermore in other parts of the app I have AnimatedImage views that are display user selected data. So let's say user has image A loaded in an AnimatedImage. They use an image picker to select image b. AnimatedImage now shows image B. On 2.0.2 this works as expected. On 2.1.0 the AnimatedImage aways displays image A.
The issue seems to be caused by AnimatedImage imageModel_SwiftUI being a @StateObject. Changing imageModel_SwiftUI to @ObservedObject (AnimatedImage.swift l:104) fixed this issue. Other fixes introduced by 2.1.0 seem to remain with this change (tested on iOS 16).
Thank you,
Stanislav Jidkov