Wrap A Model View In A UINavigationController

You can put BarButtonItems on a UINavigationController too!

Steven Curtis
2 min readSep 25, 2022
Photo by Paul Skorupskas on Unsplash

Before we start

Difficulty: Beginner | Easy | Normal | Challenging

This article has been developed using Xcode 12.5, and Swift 5.4

You know what I’ve wanted to do for a long time? Make a modally presented UIViewController look decent, and have bar button items to make it a little bit easier to use.

Here is a quick tutorial to demonstrate exactly that!

The Code

There isn’t anything special about the storyboard here. I have (rather simply) added a button to a view controller, and hooked up the outlet in code.

The Modal in this case is really simple. I’ll just create a programmatic view controller with a red background. Let me also set a creative title, “My Title” to ensure that the right view is being displayed!

--

--