Skip to content

Instantly share code, notes, and snippets.

@bharathreddys77
Created August 13, 2019 06:27
Show Gist options
  • Save bharathreddys77/5961ec6810e6b09815b7d735949c751a to your computer and use it in GitHub Desktop.
Save bharathreddys77/5961ec6810e6b09815b7d735949c751a to your computer and use it in GitHub Desktop.
protocol viewAnimatable {
func animateView(duration:TimeInterval)
}
extension viewAnimatable where Self:UIView {
func animateView(duration:TimeInterval) {
UIView.animate(withDuration: duration, animations: {
self.alpha = 0.5
}) { (_) in
self.alpha = 1.0
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment