Connecting a Root Navigation Controller in Swift Using Storyboard
By default, Capacitor apps are embedded in a CAPBridgeViewController
. To utilize the "push" type for presenting portals, it is necessary to embed the app within a navigation controller.
Step 1: Open the Main Storyboard
- In the project navigator, locate and open the
Main.storyboard
file.
Step 2: Add a Navigation Controller
- Drag and drop a "Navigation Controller" from the Object Library onto the storyboard canvas.
- The navigation controller will come with an attached view controller. Remove the attached view controller and add a root view controller seugue from the navigation controller to the bridge view controller.
Step 3: Set the Initial View Controller
- Set the navigation controller as the initial view controller.
Step 4: Customize the Navigation Controller
- To remove the navigation bar, set "Top Bar" to "None" in the Simulated Metrics section of the navigation controller.