Multi-column navigation with NavigationSplitView
NavigationSplitView is a container view that presents views in two or three columns; selections in leading columns control the presentations in subsequent columns. It was introduced with iOS 16 along with NavigationStack and the new NavigationLink functions. The mail app on the iPad is an example of a three-column layout you may be familiar with.
Getting ready
- Our starting point will be the app from the “Typed data-driven navigation with NavigationStack” recipe. Either duplicate the folder of the app you created in that recipe, or download the complete code for that recipe from the GitHub repository.
How to do it…
- To show the power of NavigationSplitView, we will modify the layout of the app to use a three-column layout for a regular horizontal size class environment, like in the iPad, and fall back to a traditional navigation stack layout for a compact horizontal size class environment, like in the iPhone. The...