Skip to content

Instantly share code, notes, and snippets.

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