diff --git a/Modules/Sources/WordPressUI/Constants/UIKitConstants.swift b/Modules/Sources/WordPressUI/Constants/UIKitConstants.swift deleted file mode 100644 index 461ad2bcb725..000000000000 --- a/Modules/Sources/WordPressUI/Constants/UIKitConstants.swift +++ /dev/null @@ -1,9 +0,0 @@ -import Foundation - -// MARK: UIKit Constants -// -public class UIKitConstants { - public static let alphaMid: CGFloat = 0.5 - public static let alphaZero: CGFloat = 0 - public static let alphaFull: CGFloat = 1 -} diff --git a/Modules/Sources/WordPressUI/Extensions/UIView+Animations.swift b/Modules/Sources/WordPressUI/Extensions/UIView+Animations.swift index ce556c3887c8..202cc0138d37 100644 --- a/Modules/Sources/WordPressUI/Extensions/UIView+Animations.swift +++ b/Modules/Sources/WordPressUI/Extensions/UIView+Animations.swift @@ -70,10 +70,10 @@ extension UIView { /// Applies a fade in animation /// public func fadeInAnimation(_ completion: ((Bool) -> Void)? = nil) { - alpha = UIKitConstants.alphaMid + alpha = 0.5 UIView.animate(withDuration: Animations.duration, animations: { [weak self] in - self?.alpha = UIKitConstants.alphaFull + self?.alpha = 1 }, completion: { success in completion?(success) }) @@ -83,11 +83,11 @@ extension UIView { /// public func fadeInWithRotationAnimation(_ completion: ((Bool) -> Void)? = nil) { transform = CGAffineTransform.makeRotation(-270, scale: 3) - alpha = UIKitConstants.alphaZero + alpha = 0 UIView.animate(withDuration: Animations.duration, animations: { self.transform = CGAffineTransform.makeRotation(0, scale: 0.75) - self.alpha = UIKitConstants.alphaFull + self.alpha = 1 }, completion: { _ in UIView.animate(withDuration: Animations.duration, animations: { self.transform = CGAffineTransform(scaleX: 1.0, y: 1.0) @@ -102,7 +102,7 @@ extension UIView { public func fadeOutWithRotationAnimation(_ completion: ((Bool) -> Void)? = nil) { UIView.animate(withDuration: Animations.duration, animations: { self.transform = CGAffineTransform.makeRotation(120, scale: 3) - self.alpha = UIKitConstants.alphaZero + self.alpha = 0 }, completion: { success in completion?(success) }) @@ -113,7 +113,7 @@ extension UIView { public func explodeAnimation(_ completion: ((Bool) -> Void)? = nil) { UIView.animate(withDuration: Animations.duration, animations: { self.transform = CGAffineTransform(scaleX: 3.0, y: 3.0) - self.alpha = UIKitConstants.alphaZero + self.alpha = 0 }, completion: { success in completion?(success) }) @@ -123,10 +123,10 @@ extension UIView { /// public func implodeAnimation(_ completion: ((Bool) -> Void)? = nil) { transform = CGAffineTransform(scaleX: 3.0, y: 3.0) - alpha = UIKitConstants.alphaZero + alpha = 0 UIView.animate(withDuration: Animations.duration, animations: { - self.alpha = UIKitConstants.alphaFull + self.alpha = 1 self.transform = CGAffineTransform(scaleX: 1.0, y: 1.0) }, completion: { success in completion?(success) @@ -143,7 +143,7 @@ extension UIView { } self.isHidden = false - let alpha: CGFloat = isHidden ? UIKitConstants.alphaZero : UIKitConstants.alphaFull + let alpha: CGFloat = isHidden ? 0 : 1 UIView.animate(withDuration: Animations.duration, delay: 0, options: .transitionCrossDissolve, animations: { self.alpha = alpha }) { success in diff --git a/Modules/Sources/WordPressUI/FancyAlert/FancyAlertPresentationController.swift b/Modules/Sources/WordPressUI/FancyAlert/FancyAlertPresentationController.swift index cf4d30b15172..c14593b01392 100644 --- a/Modules/Sources/WordPressUI/FancyAlert/FancyAlertPresentationController.swift +++ b/Modules/Sources/WordPressUI/FancyAlert/FancyAlertPresentationController.swift @@ -11,7 +11,7 @@ open class FancyAlertPresentationController: UIPresentationController, UIViewCon private let dimmingView: UIView = { $0.translatesAutoresizingMaskIntoConstraints = false $0.backgroundColor = UIColor(white: 0.0, alpha: Constants.dimmingViewAlpha) - $0.alpha = UIKitConstants.alphaZero + $0.alpha = 0 return $0 }(UIView()) @@ -22,12 +22,12 @@ open class FancyAlertPresentationController: UIPresentationController, UIViewCon containerView.pinSubviewToAllEdges(dimmingView) guard let transitionCoordinator = presentingViewController.transitionCoordinator else { - dimmingView.alpha = UIKitConstants.alphaFull + dimmingView.alpha = 1 return } transitionCoordinator.animate(alongsideTransition: { _ in - self.dimmingView.alpha = UIKitConstants.alphaFull + self.dimmingView.alpha = 1 }) } @@ -39,13 +39,13 @@ open class FancyAlertPresentationController: UIPresentationController, UIViewCon override open func dismissalTransitionWillBegin() { guard let coordinator = presentedViewController.transitionCoordinator else { - dimmingView.alpha = UIKitConstants.alphaZero + dimmingView.alpha = 0 return } coordinator.animate(alongsideTransition: { _ in - self.dimmingView.alpha = UIKitConstants.alphaZero + self.dimmingView.alpha = 0 }) } diff --git a/Modules/Sources/WordPressUI/FancyAlert/FancyAlertViewController.swift b/Modules/Sources/WordPressUI/FancyAlert/FancyAlertViewController.swift index 10b82a242b1f..1203f38a1af3 100644 --- a/Modules/Sources/WordPressUI/FancyAlert/FancyAlertViewController.swift +++ b/Modules/Sources/WordPressUI/FancyAlert/FancyAlertViewController.swift @@ -409,7 +409,7 @@ open class FancyAlertViewController: UIViewController { @objc func fadeAllViews(visible: Bool, alongside animation: ((FancyAlertViewController) -> Void)? = nil, completion: ((Bool) -> Void)? = nil) { UIView.animate(withDuration: Constants.fadeAnimationDuration, animations: { - self.alertView.contentViews.forEach { $0.alpha = (visible) ? UIKitConstants.alphaFull : UIKitConstants.alphaZero } + self.alertView.contentViews.forEach { $0.alpha = (visible) ? 1 : 0 } animation?(self) }, completion: completion) }