Skip to content

Instantly share code, notes, and snippets.

@wbbernardes
Created June 27, 2020 16:31
Show Gist options
  • Save wbbernardes/7c601d3944ec4a7ccb8367e97507503c to your computer and use it in GitHub Desktop.
Save wbbernardes/7c601d3944ec4a7ccb8367e97507503c to your computer and use it in GitHub Desktop.
lottie
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