Commit c72a7322 by Daniel Dahan Committed by GitHub

Merge pull request #42 from OrkhanAlikhanov/issue-29

Fixed issue-29, unbalanced calls to begin/end appearance transitions
parents d3b27d75 7122dfd4
......@@ -65,6 +65,7 @@ extension MotionTransition {
progress = 0
totalDuration = 0
state = .possible
isModalTransition = false
}
state = .completing
......
......@@ -41,6 +41,7 @@ extension MotionTransition: UIViewControllerTransitioningDelegate {
state = .notified
isPresenting = true
isModalTransition = true
fromViewController = fromViewController ?? presenting
toViewController = toViewController ?? presented
......@@ -54,6 +55,7 @@ extension MotionTransition: UIViewControllerTransitioningDelegate {
state = .notified
isPresenting = false
isModalTransition = true
fromViewController = fromViewController ?? dismissed
return self
}
......
......@@ -272,6 +272,13 @@ open class MotionTransition: NSObject {
/// Whether or not we are presenting the destination view controller.
public internal(set) var isPresenting = true
/**
A boolean indicating if the transition is of modal type.
True if `viewController.present(_:animated:completion:)` or
`viewController.dismiss(animated:completion:)` is called, false otherwise.
*/
public internal(set) var isModalTransition = false
/// A boolean indicating whether the transition interactive or not.
public var isInteractive: Bool {
return !progressRunner.isRunning
......@@ -588,8 +595,10 @@ internal extension MotionTransition {
return
}
if !isModalTransition {
fvc.beginAppearanceTransition(false, animated: true)
tvc.beginAppearanceTransition(true, animated: true)
}
processForMotionDelegate(viewController: fvc) { [weak self] in
guard let `self` = self else {
......@@ -625,8 +634,10 @@ internal extension MotionTransition {
return
}
if !isModalTransition {
tvc.endAppearanceTransition()
fvc.endAppearanceTransition()
}
processForMotionDelegate(viewController: fvc) { [weak self] in
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