You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.scaledToFit() // Attention to call it on AnimatedImage, but not `some View` after View Modifier (Swift Protocol Extension method is static dispatched)
@@ -176,7 +180,11 @@ var body: some View {
176
180
AnimatedImage(name: "animation1", isAnimating: $isAnimating)) // Animation control binding
// Coordinator, used for Cocoa Binding or Delegate method
180
188
let coordinator = context.coordinator
181
189
}
182
190
}
@@ -187,6 +195,8 @@ Note: `AnimatedImage` supports both image url or image data for animated image f
187
195
188
196
Note: `AnimatedImage` some methods like `.transition`, `.indicator` and `.aspectRatio` have the same naming as `SwiftUI.View` protocol methods. But the args receive the different type. This is because `AnimatedImage` supports to be used with UIKit/AppKit component and animation. If you find ambiguity, use full type declaration instead of the dot expression syntax.
189
197
198
+
Note: some of methods on `AnimatedImage` will return `some View`, a new Modified Content. You'll lose the type related modifier method. For this case, you can either reorder the method call, or use Native View in `.onViewUpdate` for rescue.
199
+
190
200
```swift
191
201
var body: some View {
192
202
AnimatedImage(name: "animation2") // Just for showcase, don't mix them at the same time
/// - note: The differences between this and placeholder image, it's that placeholder image replace the image for image view, but this modify the View Hierarchy to overlay the placeholder hosting view
759
+
publicfunc placeholder<T>(@ViewBuilder content:()->T)->AnimatedImagewhere T :View{
0 commit comments