1

I have a modal (form sheet) segue in my application on the iPad that changes to a UINavigationController when the horizontalSizeClass is regular. To achieve that, I am using UIAdaptivePresentationControllerDelegate as in the code below:

extension MyListViewController: UIAdaptivePresentationControllerDelegate {
    func presentationController(_ controller: UIPresentationController, viewControllerForAdaptivePresentationStyle style: UIModalPresentationStyle) -> UIViewController? {
        if style == .fullScreen {
            return UINavigationController(rootViewController: controller.presentedViewController)
        }
    }
}

However, I want my presentedViewController to be shown not in a new UINavigationController, but in the same UINavigationController that is already being used in my whole application. That way, I would not need to specify a Back button and could reuse the same navigationBar of the main UINavigationController.

How can I implement that?

Amal T S
  • 3,327
  • 2
  • 24
  • 57
Dadevape
  • 11
  • 2

0 Answers0