Open nrigoni22 opened 1 year ago
Any update on this. I too facing this issue.
I'm having the same issue.
This can not been fixed, unless I remove iOS 13 support with SwiftUI.StateObject (not that Compatibility.StateObject)
Do you have an idea what is the root problem? I think we might be able to fork the dependency and temporarily fix them ourselves.
The root of this problem is because the SDWebImage Core's design, when query memory cache, it callback in sync (which means, just like a normal non-async function call), and trigger the ImageManager.image
update
The ImageManager.load(url:)
API is called inside View.body
, and SwiftUI prohibit the changes in sync during View.body
call.
Just add “Dispatch.main.asyn {}” to warning places will fix the issue.
Hi, just wondering if this is planned to be fixed any time soon. I use image loader heavily on my app and this causes thousands of warnings.
Kingfisher
also has a similar SwiftUI view
called KFImage
. In the meantime, we can substitute this framework with Kingfisher.
Just noticed AsyncImage is pretty great on SwiftUI, I'm probably using that now.
I have no extra time on iOS 13 backport. I think this is because of the @StateObject
.
Drop iOS 13 support, please try with this to see the result:https://github.com/SDWebImage/SDWebImageSwiftUI/pull/250
I had the same problem, [SwiftUI] Publishing changes from within view updates is not allowed, this will cause undefined behavior.
what is the solution because i have the same problem now
Any updates on this one? Seems like the WebImage
might just need to be made a main actor, or the ImageManager needs to declare some MainActor usages in it's asynchronous portions?
Update: Doesn't seem to be that simple. Tried that and still have issues
From update to Xcode 14 and 14.1 I have some mornings that points in the ImageManager.swift all says: Publishing changes from within view updates is not allowed, this will cause undefined behavior.
how can be solved?