1234567891011121314151617181920212223242526272829303132333435363738 |
- import UIKit
- public protocol PresentAnimatable {
- func toViewPresentedAnimation(duration: TimeInterval, in view: UIView)
- func fromViewPresentingAnimation(duration: TimeInterval, in view: UIView)
- func contentViewAppearAnimation(duration: TimeInterval, in view: UIView)
- func contentViewDisappearAnimation(duration: TimeInterval, in view: UIView)
- }
- public extension PresentAnimatable {
- func toViewPresentedAnimation(duration: TimeInterval, in view: UIView) {
- UIView.transition(with: view, duration: duration, options: [], animations: {
- view.backgroundColor = UIColor(red: 52 / 255,
- green: 52 / 255,
- blue: 52 / 255,
- alpha: 0.7)
- })
- }
- func fromViewPresentingAnimation(duration: TimeInterval, in view: UIView) {
- UIView.transition(with: view, duration: duration, options: [], animations: {
- view.backgroundColor = UIColor(red: 52 / 255,
- green: 52 / 255,
- blue: 52 / 255,
- alpha: 0)
- })
- }
- }
|