Skip to content

Instantly share code, notes, and snippets.

@laevandus
Created August 31, 2019 07:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laevandus/bb9a4ec22cb69a13c7f67948e424c0d9 to your computer and use it in GitHub Desktop.
Save laevandus/bb9a4ec22cb69a13c7f67948e424c0d9 to your computer and use it in GitHub Desktop.
import SwiftUI
struct ContentView: View {
@ObservedObject var imageAnimator: ImageAnimator
var body: some View {
ZStack {
if imageAnimator.image != nil {
Image(imageAnimator.image!, scale: 1.0, label: Text("Gif"))
}
else {
Text("Paused")
}
}.onAppear {
self.imageAnimator.startAnimating()
}.onDisappear {
self.imageAnimator.stopAnimating()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment