Post

Replies

Boosts

Views

Activity

Reply to Embedding a NavigationStack within the detail view of a NavigationSplitView
Thanks for your reply - I've submitted FB12171134. Here's a minimal code example to reproduce (I appreciate the Stack here doesn't achieve anything, but the behaviour is the same): class Row: Identifiable, Hashable { let id: UUID let title: String init(title: String) { self.id = UUID() self.title = title } static func == (lhs: Row, rhs: Row) -> Bool { return lhs.id == rhs.id } func hash(into hasher: inout Hasher) { hasher.combine(id) } } struct ContentView: View { let rows = [Row(title: "Row 1"), Row(title: "Row 2"), Row(title: "Row 3")] @State var selectedRow: Row? var body: some View { NavigationSplitView { List(selection: $selectedRow) { ForEach(rows) { row in NavigationLink(value: row) { Text(row.title) } } } .navigationTitle("Root List") } detail: { if let selectedRow = selectedRow { RowView(row: selectedRow) } } } } import SwiftUI struct RowView: View { let row: Row var body: some View { NavigationStack { VStack { Text("Detail View") } .navigationTitle(row.title) .toolbar { ToolbarItem(placement: .navigationBarTrailing) { Button { // Empty } label: { Label("Add", systemImage: "plus") } } } } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’23
Reply to Combining NavigationSplitView and TabView in iOS 18
Hi Max, sorry I should have updated this thread - the issue was resolved by the end of the beta cycle. My view is entirely SwiftUI. As of 18.3, there is no spacing issue, but I do find I need to move buttons that are trailing to be leading in some cases such that they are not hidden by the tab selector.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Feb ’25
Reply to Embedding a NavigationStack within the detail view of a NavigationSplitView
Thanks for your reply - I've submitted FB12171134. Here's a minimal code example to reproduce (I appreciate the Stack here doesn't achieve anything, but the behaviour is the same): class Row: Identifiable, Hashable { let id: UUID let title: String init(title: String) { self.id = UUID() self.title = title } static func == (lhs: Row, rhs: Row) -> Bool { return lhs.id == rhs.id } func hash(into hasher: inout Hasher) { hasher.combine(id) } } struct ContentView: View { let rows = [Row(title: "Row 1"), Row(title: "Row 2"), Row(title: "Row 3")] @State var selectedRow: Row? var body: some View { NavigationSplitView { List(selection: $selectedRow) { ForEach(rows) { row in NavigationLink(value: row) { Text(row.title) } } } .navigationTitle("Root List") } detail: { if let selectedRow = selectedRow { RowView(row: selectedRow) } } } } import SwiftUI struct RowView: View { let row: Row var body: some View { NavigationStack { VStack { Text("Detail View") } .navigationTitle(row.title) .toolbar { ToolbarItem(placement: .navigationBarTrailing) { Button { // Empty } label: { Label("Add", systemImage: "plus") } } } } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’23