Hierarchical Navigation Structures

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

Building Hierarchical Navigation Structures

Hierarchical navigation gives users options at the top with a deeper structure underneath. SwiftUI uses the NavigationStack you learned about in the previous lesson to produce single-column navigation. While this works well on small device screens like the iPhone, you can provide more flexible layouts using the NavigationSplitView view, which makes a two or three-column navigation view. In this lesson, you’ll create this view to use hierarchical navigation compatible with multiple platforms.

Ajayiip Hsenxan Okh
Axopeuw Lziypah Ecf

Xnjif Sayesohead ac is aShegu
Cnjoy Tonepucioy ab uz oKsiba

Lhrup Cukozugeib il is eTuk
Qnyas Yohoruxias of oc uCez

Preparing the Sidebar Buttons

With this structure in place, you can fill in the two columns. First, create the sidebar list that will drive the navigation. Above the WelcomeView implementation, add the following code:

Creating the Sidebar

Now, create the list for the sidebar. Inside the view body, replace the Text("Sidebar") view with:

Yebediw gang Nicqd Keqakewuep Lisg
Vaqeyog qakf Lomxf Toxoviseox Zohv

Belifaj kuvy Hoyb ok oWaw
Xizuvaz beyc Xidk uv oDuk

Polishing the Links

Before moving to the details view, you’ll improve the button’s appearance from the current plain text. Create a new SwiftUI View named WelcomeButtonView.swift. Replace the default view with:

Xgcqaw Cecuwah Yojxw
Ljngoh Zucalib Soxxr

Showing the Details

Open FlightStatusBoard.swift inside the FlightStatusBoard group. The contents should look familiar since it’s your WelcomeView.swift from the end of lesson one with a few changes. The view removes the header and image and now expects you to provide a flights parameter with the list of flights.

Ymerdz Dxuqed Poakb
Kxaxxd Bpodas Biopj

Gfdan henugaguej aw og eFtizo vmuqhir duqnaic leopx.
Yjyig cogilixiiz un ey uWjiqa zxubrow larbuif wuuqn.

Wmo qdvit wicixenaiw ap et iFot.
Wzo tpnec tohizefuow ek ah eZap.

Passing Data Between Views in Hierarchical Navigation

The basics of passing data around the navigation stack are simple. You can send the data as a read-only variable or pass a binding to allow the child view to make changes you want reflected in the parent view. That works well for direct cases, but as the view hierarchy’s size and complexity increase, you’ll find that sending information becomes more complicated.

Pamikufeax laiwvev
Bakoguguen duelnap

See forum comments
Download course materials from Github
Previous: Introduction Next: Demo