Created
February 23, 2020 08:23
-
-
Save harryhan24/5de4b4f87ca2c390a461b0795eabbf51 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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