From 0de56fefebd17543fd0bb5eb29b62d038d55b6f5 Mon Sep 17 00:00:00 2001 From: jonkykong Date: Wed, 19 Oct 2016 23:26:07 -0700 Subject: [PATCH] Removing behavior to present a menu if pushing isn't available as more true to expected behavior. --- Pod/Classes/UISideMenuNavigationController.swift | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/Pod/Classes/UISideMenuNavigationController.swift b/Pod/Classes/UISideMenuNavigationController.swift index e782da5..b593a74 100644 --- a/Pod/Classes/UISideMenuNavigationController.swift +++ b/Pod/Classes/UISideMenuNavigationController.swift @@ -119,7 +119,7 @@ open class UISideMenuNavigationController: UINavigationController { } override open func pushViewController(_ viewController: UIViewController, animated: Bool) { - guard viewControllers.count > 0 else { + guard viewControllers.count > 0 && !SideMenuManager.menuAllowSubmenus else { // NOTE: pushViewController is called by init(rootViewController: UIViewController) // so we must perform the normal super method in this case. super.pushViewController(viewController, animated: true) @@ -127,13 +127,7 @@ open class UISideMenuNavigationController: UINavigationController { } guard let presentingViewController = presentingViewController as? UINavigationController else { - present(viewController, animated: animated, completion: nil) - print("SideMenu Warning: cannot push a ViewController from a ViewController without a NavigationController. It will be presented it instead.") - return - } - - if SideMenuManager.menuAllowSubmenus{ - super.pushViewController(viewController, animated: true) + print("SideMenu Warning: attempt to push a ViewController from a ViewController without a NavigationController. Your ViewController must be embedded in a NavigationController for this to work.") return }