AutorÃa | Ultima modificación | Ver Log |
//// LottieView.swift// twogetskills//// Created by Efrain Yanez Recanatini on 7/12/22.//import SwiftUIimport Lottiestruct LottieView: UIViewRepresentable {var name: Stringvar loopMode: LottieLoopMode = .playOncevar animationView = AnimationView()func makeUIView(context: UIViewRepresentableContext<LottieView>) -> UIView {let view = UIView(frame: .zero)animationView.animation = Animation.named(name)animationView.contentMode = .scaleAspectFitanimationView.loopMode = loopModeanimationView.play()animationView.translatesAutoresizingMaskIntoConstraints = falseview.addSubview(animationView)NSLayoutConstraint.activate([animationView.heightAnchor.constraint(equalTo: view.heightAnchor),animationView.widthAnchor.constraint(equalTo: view.widthAnchor)])return view}func updateUIView(_ uiView: UIView, context: UIViewRepresentableContext<LottieView>) {}}