Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extension UIView {
- func show(animated: Bool) {
- self.isHidden = false
- if animated {
- UIView.animate(
- withDuration: animationDuration,
- animations: {
- self.alpha = 1
- }
- )
- } else {
- self.alpha = 1
- }
- }
- func hide(animated: Bool) {
- if animated {
- UIView.animate(
- withDuration: animationDuration,
- animations: {
- self.alpha = 0
- },
- completion: { _ in
- self.isHidden = true
- }
- )
- } else {
- self.alpha = 0
- self.isHidden = true
- }
- }
- }
- fileprivate var animationDuration: TimeInterval = 0.3
Add Comment
Please, Sign In to add comment