From f1e4efeb468d29ba19cccabb4bde0289d103bcfe Mon Sep 17 00:00:00 2001 From: jonkykong Date: Sun, 21 Jul 2019 21:43:07 -0700 Subject: [PATCH] Refactor --- Pod/Classes/UISideMenuNavigationController.swift | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Pod/Classes/UISideMenuNavigationController.swift b/Pod/Classes/UISideMenuNavigationController.swift index d753931..fe10fc0 100644 --- a/Pod/Classes/UISideMenuNavigationController.swift +++ b/Pod/Classes/UISideMenuNavigationController.swift @@ -166,12 +166,12 @@ open class UISideMenuNavigationController: UINavigationController { // When presenting a view controller from the menu, the menu view gets moved into another transition view above our transition container // which can break the visual layout we had before. So, we move the menu view back to its original transition view to preserve it. + if let presentingView = presentingViewController?.view, let containerView = presentingView.superview { + containerView.addSubview(view) + } + if dismissOnPresent && !isBeingDismissed { // We're presenting a view controller from the menu, so we need to hide the menu so it isn't showing when the presented view is dismissed. - if let presentingView = presentingViewController?.view, let containerView = presentingView.superview { - containerView.addSubview(view) - } - transitionController?.transition(presenting: false, animated: animated, alongsideTransition: { [weak self] in guard let self = self else { return } self.activeDelegate?.sideMenuWillDisappear?(menu: self, animated: animated) @@ -206,11 +206,11 @@ open class UISideMenuNavigationController: UINavigationController { activeDelegate?.sideMenuDidDisappear?(menu: self, animated: animated) - if dismissOnPresent && !isBeingDismissed { - view.isHidden = true - } else { + if isBeingDismissed { transitionController = nil interactive = false + } else if dismissOnPresent { + view.isHidden = true } }