Last updated 5 months ago
Was this helpful?
[ deprecated ]
Design+Code โฉ
Mastering SwiftUI, Ch. 11: Navigation UI
Nick McConnell โฉ
Sarun โฉ
Adding a view is a useful way to give the second column (details pane, or primary pane) a placeholder view.
๐ see example 1 below.
// example 1 NavigationView { // โญ๏ธ `List` of `NavigationLink`s List(model.notes) { note in NavigationLink(note.title, destination: NoteEditor(id: note.id)) } // โญ๏ธ ้้จๅ็ซ็ถๆใ่ชๅๅบ็พใ่ไธใๅชๅบ็พใๅจ "details pane"โ๏ธ Text("Select a Note") } // example 2 struct AccountView: View { var body: some View { NavigationView { // navigation view List { // list Section { // list section Text("Settings") Text("Billings") Text("Help") }.listRowSeparatorTint(.gray) // color of the separator Section { // list section Text("Feedback") Text("Support") }.listRowSeparator(.hidden) // hide separators } .listStyle(.insetGrouped) // list style .navigationTitle("Account") // navigation title } } }
.navigationBarTitle() deprecated.
List is used as content.
use NavigationLink to navigate to other views.
โฉ
โฉ โฉ
- used in views like , , and
Text
List
Picker
Form