0

Estoy intentando mostrar imagenes gif SDWebImageSwiftUI

https://github.com/SDWebImage/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()
    }
}

1 respuesta 1

0
//
//  gifView.swift
//  umbre
//
//  Created by Desarollo on 11/27/19.
//  Copyright © 2019 Dream. All rights reserved.
//

import SwiftUI
import SDWebImageSwiftUI
import SDWebImage

struct gifView: View {
      let url = URL(string: "https://s5.gifyu.com/images/ubrellagif.gif")!
     var body: some View {
         VStack {
             AnimatedImage(url: url)
                 .scaledToFit()
                 .frame(width: 850, height: 850)

         }
     }
}

struct gifView_Previews: PreviewProvider {
    static var previews: some View {
        gifView()
    }
}

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.