Created
August 5, 2020 09:42
-
-
Save LeTarrask/d0b91ae0c0fee077cfbe757a0b3a6819 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
| // Generic App config enum | |
| enum AppConfig { | |
| static let apiBaseURL = URL(string: "https://api.swiftbysundell.com")! | |
| static var enableExperimentalFeatures = false | |
| ... | |
| } | |
| // Animation States | |
| extension Animation { | |
| enum RepeatMode: Equatable { | |
| case once | |
| case times(Int) | |
| case never | |
| case forever | |
| } | |
| } | |
| func animationDidFinish(_ animation: Animation) { | |
| switch animation.repeatMode { | |
| case .once: | |
| if animation.playCount == 1 { | |
| startAnimation(animation) | |
| } | |
| case .times(let times): | |
| if animation.playCount <= times { | |
| startAnimation(animation) | |
| } | |
| case .never: | |
| break | |
| case .forever: | |
| startAnimation(animation) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment