Skip to content

Refactor WebImage/AnimatedImage using SwiftUIBackports and StateObject #227

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

Merged
merged 9 commits into from
Sep 15, 2022

Conversation

dreampiggy
Copy link
Collaborator

This PR close #225 #222

Note

This is the Last Version which support iOS 13. The back port is really pain

Changes

WebImage

  1. Use SwiftUIBackport to use StateObject/OnChange/Overlay
  2. Change the Indicator API to match the transform for ImageManager
  3. Remove the unused PlatformApear hack

AnimatedImage

  1. Use context.coordinator to store loading status because it's exclusive unlike normal SwiftUI.View

API Break

  1. The IndicatorReportable design is wrong. And removed with IndicatorStatus ObservableObject class. You can migrate using a self-created @ObservedObject var status = IndicatorStatus(), then use onReceive(myLoadingStatus) to trigger update on that IndicatorStatus
    (I don't think anyone beside me use this API, actually this does not effect the user-level .indicator(.progress) API...)

Warnings

  1. Fix Xcode 14's warinng

Publishing changes from within view updates is not allowed, this will cause undefined behavior.

@garrettrayj

1. Use SwiftUIBackport to use StateObject/OnChange/Overlay
2. Change the Indicator API to match the transform for ImageManager
3. Remove the unused PlatformApear hack
@dreampiggy dreampiggy added API API changes animated image AnimatedImage struct webimage WebImage struct warning Xcode warning labels Sep 14, 2022
@dreampiggy dreampiggy added this to the 2.1.0 milestone Sep 14, 2022
@dreampiggy dreampiggy force-pushed the refactor_xcode14_state_update branch from 652419a to 53a4349 Compare September 14, 2022 16:52
Use context.coordinator to store loading status because it's exclusive unlike normal SwiftUI.View
Added something about the behavior
@dreampiggy dreampiggy force-pushed the refactor_xcode14_state_update branch from 53a4349 to e86386c Compare September 14, 2022 17:20
Copy link

@garrettrayj garrettrayj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work. Thanks!

@dreampiggy dreampiggy force-pushed the refactor_xcode14_state_update branch 4 times, most recently from e77305f to c807dce Compare September 15, 2022 07:01
@dreampiggy dreampiggy force-pushed the refactor_xcode14_state_update branch from c807dce to 4b7cbfc Compare September 15, 2022 07:06
@dreampiggy
Copy link
Collaborator Author

The test cases failed because the ViewInspector no longer can find the group.image(0). However, I check the real demo and it works as expected.

May fix later, currently I just merge and release v2.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
animated image AnimatedImage struct API API changes warning Xcode warning webimage WebImage struct
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants