Created
February 1, 2018 07:46
-
-
Save Anatoli-Petrosyants/4fb276a73bc1ba306f6fad749786e345 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 UIKit | |
extension UIView { | |
func fadeIn(_ duration: Double) { | |
fadeIn(duration, 0) | |
} | |
func fadeOut(_ duration: Double) { | |
fadeOut(duration, 0) | |
} | |
func fadeIn(_ duration: Double, _ delay: Double) { | |
UIView.animate(withDuration: duration, delay: delay, options: UIViewAnimationOptions.curveEaseIn, animations: { | |
self.alpha = 1.0 | |
}, completion: nil) | |
} | |
func fadeOut(_ duration: Double, _ delay: Double) { | |
UIView.animate(withDuration: duration, delay: delay, options: UIViewAnimationOptions.curveEaseOut, animations: { | |
self.alpha = 0.0 | |
}, completion: nil) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment