Commit c46cc0b6 by Orkhan Alikhanov

No need to call appearance methods when transitionContext exists

They are called by UIKit
parent edc38b64
...@@ -85,7 +85,7 @@ fileprivate extension MotionTransition { ...@@ -85,7 +85,7 @@ fileprivate extension MotionTransition {
/// Prepares the from and to view controllers. /// Prepares the from and to view controllers.
func prepareViewControllers() { func prepareViewControllers() {
processStartTransitionDelegation(fromViewController: fromViewController, toViewController: toViewController) processStartTransitionDelegation(transitionContext: transitionContext, fromViewController: fromViewController, toViewController: toViewController)
} }
/// Prepares the snapshot view, which hides any flashing that may occur. /// Prepares the snapshot view, which hides any flashing that may occur.
......
...@@ -589,10 +589,11 @@ public extension MotionTransition { ...@@ -589,10 +589,11 @@ public extension MotionTransition {
internal extension MotionTransition { internal extension MotionTransition {
/** /**
Processes the start transition delegation methods. Processes the start transition delegation methods.
- Parameter transitionContext: An optional UIViewControllerContextTransitioning.
- Parameter fromViewController: An optional UIViewController. - Parameter fromViewController: An optional UIViewController.
- Parameter toViewController: An optional UIViewController. - Parameter toViewController: An optional UIViewController.
*/ */
func processStartTransitionDelegation(fromViewController: UIViewController?, toViewController: UIViewController?) { func processStartTransitionDelegation(transitionContext: UIViewControllerContextTransitioning?, fromViewController: UIViewController?, toViewController: UIViewController?) {
guard let fvc = fromViewController else { guard let fvc = fromViewController else {
return return
} }
...@@ -601,7 +602,7 @@ internal extension MotionTransition { ...@@ -601,7 +602,7 @@ internal extension MotionTransition {
return return
} }
if !isModalTransition { if transitionContext == nil {
fvc.beginAppearanceTransition(false, animated: true) fvc.beginAppearanceTransition(false, animated: true)
tvc.beginAppearanceTransition(true, animated: true) tvc.beginAppearanceTransition(true, animated: true)
} }
...@@ -640,7 +641,7 @@ internal extension MotionTransition { ...@@ -640,7 +641,7 @@ internal extension MotionTransition {
return return
} }
if !isModalTransition { if transitionContext == nil {
tvc.endAppearanceTransition() tvc.endAppearanceTransition()
fvc.endAppearanceTransition() fvc.endAppearanceTransition()
} }
...@@ -681,10 +682,12 @@ internal extension MotionTransition { ...@@ -681,10 +682,12 @@ internal extension MotionTransition {
return return
} }
tvc.beginAppearanceTransition(false, animated: true) if transitionContext == nil {
tvc.endAppearanceTransition() tvc.beginAppearanceTransition(false, animated: true)
fvc.beginAppearanceTransition(true, animated: true) tvc.endAppearanceTransition()
fvc.endAppearanceTransition() fvc.beginAppearanceTransition(true, animated: true)
fvc.endAppearanceTransition()
}
processForMotionDelegate(viewController: fvc) { [weak self] in processForMotionDelegate(viewController: fvc) { [weak self] in
guard let `self` = self else { guard let `self` = self else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment