Created
June 27, 2020 16:31
-
-
Save wbbernardes/7c601d3944ec4a7ccb8367e97507503c to your computer and use it in GitHub Desktop.
lottie
This file contains 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 UIKit | |
import Lottie | |
class LoadingViewController: UIViewController { | |
// MARK: - Outlets | |
@IBOutlet weak var viewAnimation: UIView! { | |
didSet { | |
viewAnimation.layer.cornerRadius = 18.0 | |
viewAnimation.layer.shadowColor = UIColor.black.cgColor | |
viewAnimation.layer.shadowOpacity = 0.5 | |
viewAnimation.layer.shadowOffset = .zero | |
viewAnimation.layer.shadowRadius = 10 | |
} | |
} | |
// MARK: - Properties | |
let animationView = AnimationView() | |
// MARK: - Lifecycle | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
startAnimation() | |
} | |
func startAnimation() { | |
animationView.frame = viewAnimation.bounds | |
animationView.animation = Animation.named("8370-loading") | |
animationView.contentMode = .scaleAspectFit | |
viewAnimation.addSubview(animationView) | |
animationView.play() | |
animationView.loopMode = .loop | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment