Created
August 31, 2019 07:56
-
-
Save laevandus/bb9a4ec22cb69a13c7f67948e424c0d9 to your computer and use it in GitHub Desktop.
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 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