SDWebImage / SDWebImageSwiftUI

SwiftUI Image loading and Animation framework powered by SDWebImage
https://sdwebimage.github.io/SDWebImageSwiftUI
MIT License
2.1k stars 216 forks source link

update Published properties of ImageManager in the main thread #233

Closed katerynatsy closed 1 year ago

katerynatsy commented 1 year ago

What?

update Published properties of ImageManager in the main thread

Why?

Publishing changes from background threads is not allowed; make sure to publish values from the main thread.

How?

As a temporary solution, enforcing assigning new values in the main thread but ideally it should be done via subscription to model changes and triggering changes as e response. i.e. via PassthroughSubject and operators like receive(on:)).

Screen Shot 2022-09-21 at 8 42 54 pm
Dmitry-rman commented 1 year ago

I have a same issue on screen with dynamic list of images, thanks! iOS 16.0 only

dreampiggy commented 1 year ago

I don't think this fix is correct.

See #232, which dispatch the onAppear in correct timing

dreampiggy commented 1 year ago

Since the #232 do the similiar things (It dispatch the onAppear with dispatch async to main), so use that instead, I just close it.

The feature is embed into that PR.