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

Fix iOS 13 compatibility && WebImage/AnimatedImage using @State to publish changes #232

Closed dreampiggy closed 1 year ago

dreampiggy commented 1 year ago

Changes

  1. Revert back the onPlatformAppear to fix iOS 14+ behavior Use backport for all OSs
  2. ImageManager API changes. The init method has no args, use load(url:options:context:) instead

This PR close #230 close #229 close #228

As for now, Swift still can not use different stored property on different availability check OS Host. This is runtime limit. Previous #227 will cause a Swift runtime crash when demangling symbols from iOS 13+

So, I just remove the SwiftUI.StateObject references and use Backport + PlatformAppear hack (Because SwiftUI.List 's onAppear does not works as expected when using non SwiftUI.StateObject)

v3.0.0 will remove iOS 13 support.

dreampiggy commented 1 year ago

The fix behavior for @State binding is OK now, testing using the new Demo

You can change the ContentView2 into ContentView) in ContentView.swift to run

Video:

Screenshot.mov.zip

dreampiggy commented 1 year ago

I think the version should bump to v2.2, not v2.1.1 patch, because it seems there are API changes and it's more than a simple bugfix.

dreampiggy commented 1 year ago

All tests passed now.