Last active
November 19, 2019 04:59
-
-
Save dmytro-anokhin/f10a5baf83f7a93e24864558c560f9c3 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
| struct AnimatedImage: UIViewRepresentable { | |
| let uiImage: UIImage | |
| func makeUIView(context: UIViewRepresentableContext<AnimatedImage>) -> UIImageView { | |
| let imageView = UIImageView(image: uiImage) | |
| imageView.contentMode = .scaleAspectFit | |
| imageView.startAnimating() | |
| return imageView | |
| } | |
| func updateUIView(_ uiView: UIImageView, context: UIViewRepresentableContext<AnimatedImage>) { | |
| uiView.image = uiImage | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment