Estoy intentando mostrar imagenes gif SDWebImageSwiftUI
pero me da error en animated Image url
Cannot invoke 'init' with an argument list of type '(url: URL?,
options: SDWebImageOptions)'
Use of unresolved identifier '$isAnimating'
import SwiftUI
import SDWebImageSwiftUI
import SDWebImage
struct gifView: View {
var body: some View {
Group {
// Network
AnimatedImage(url: URL(string: "https://raw.githubusercontent.com/liyong03/YLGIFImage/master/YLGIFImageDemo/YLGIFImageDemo/joy.gif"), options: [.progressiveLoad]) // Progressive Load
.onFailure { error in
// Error
}
.resizable() // Actually this is not needed unlike SwiftUI.Image
.placeholder(UIImage(systemName: "photo")) // Placeholder Image
.indicator(SDWebImageActivityIndicator.medium) // Activity Indicator
.transition(.fade) // Fade Transition
.scaledToFit() // Attention to call it on AnimatedImage, but not `some View` after View Modifier
// Data
AnimatedImage(data: try! Data(contentsOf: URL(fileURLWithPath: "/tmp/foo.webp")))
.customLoopCount(1) // Custom loop count
.playbackRate(2.0) // Playback speed rate
// Bundle (not Asset Catalog)
AnimatedImage(name: "animation1", isAnimating: $isAnimating);) // Animation control binding
.maxBufferSize(.max)
.onViewUpdate { view, context in // Advanced native view coordinate
view.toolTip = "Mouseover Tip"
}
}
}
}
struct gifView_Previews: PreviewProvider {
static var previews: some View {
gifView()
}
}