Skip to content
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

Xcode 14 warning on view update #243

Open
nrigoni22 opened this issue Nov 7, 2022 · 13 comments
Open

Xcode 14 warning on view update #243

nrigoni22 opened this issue Nov 7, 2022 · 13 comments
Milestone

Comments

@nrigoni22
Copy link

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?

@venkat-epifi
Copy link

Any update on this. I too facing this issue.

@ngoan
Copy link

ngoan commented Nov 17, 2022

I'm having the same issue.

@dreampiggy
Copy link
Collaborator

This can not been fixed, unless I remove iOS 13 support with SwiftUI.StateObject (not that Compatibility.StateObject)

@dreampiggy dreampiggy added this to the 3.0 milestone Nov 18, 2022
@DJBen
Copy link

DJBen commented Nov 21, 2022

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.

@dreampiggy
Copy link
Collaborator

dreampiggy commented Nov 21, 2022

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.

@abinhho
Copy link

abinhho commented Dec 9, 2022

Just add “Dispatch.main.asyn {}” to warning places will fix the issue.

@sifuentes0408
Copy link

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.

@DJBen
Copy link

DJBen commented Dec 20, 2022

Kingfisher also has a similar SwiftUI view called KFImage. In the meantime, we can substitute this framework with Kingfisher.

@sifuentes0408
Copy link

Just noticed AsyncImage is pretty great on SwiftUI, I'm probably using that now.

@dreampiggy
Copy link
Collaborator

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:#250

@zhuiyizhiqiu
Copy link

I had the same problem, [SwiftUI] Publishing changes from within view updates is not allowed, this will cause undefined behavior.

@coucoseth
Copy link

coucoseth commented Dec 19, 2023

what is the solution because i have the same problem now

@romrell4
Copy link

romrell4 commented Jan 19, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants