Skip to content

Instantly share code, notes, and snippets.

@harryhan24
Created February 23, 2020 08:23
Show Gist options
  • Select an option

  • Save harryhan24/5de4b4f87ca2c390a461b0795eabbf51 to your computer and use it in GitHub Desktop.

Select an option

Save harryhan24/5de4b4f87ca2c390a461b0795eabbf51 to your computer and use it in GitHub Desktop.
import SwiftUI
import Lottie
struct LottieView: UIViewRepresentable {
//filename을 인자로 받습니다.
@Binding var step:CGFloat
////생략
//애니메이션이 계속 반복되게합니다.
animationView.loopMode = .playOnce
return view
}
//filename이 변경될때마다 호출됩니다.
func updateUIView(_ uiView: UIView, context: UIViewRepresentableContext<LottieView>) {
animationView.play(fromProgress: step, toProgress: step+0.1)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment