Skip to content

Instantly share code, notes, and snippets.

@LeTarrask
Created August 5, 2020 09:42
Show Gist options
  • Select an option

  • Save LeTarrask/d0b91ae0c0fee077cfbe757a0b3a6819 to your computer and use it in GitHub Desktop.

Select an option

Save LeTarrask/d0b91ae0c0fee077cfbe757a0b3a6819 to your computer and use it in GitHub Desktop.
// 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