Last active
June 4, 2020 19:05
-
-
Save aheze/74418b615eefde47ff1d8a3888ee89ee 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
| /// the UIImageView that will hold the animation | |
| let imageView = UIImageView() | |
| imageView.frame = CGRect(x: 100, y: 100, width: 150, height: 150) | |
| view.addSubview(imageView) | |
| /// the images that will be animated | |
| /// images are stored in the Resources folder of this playground | |
| let imagesToAnimate = [UIImage(named: "0")!, UIImage(named: "1")!, UIImage(named: "2")!] | |
| let animationImages = UIImage.animatedImage(with: imagesToAnimate, duration: 1) | |
| /// set the imageView's images to the animation image | |
| imageView.image = animationImages |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment