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
I've filed a feedback for this change in behaviour with iOS 18.4, FB17121625
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Apr ’25
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 Combining NavigationSplitView and TabView in iOS 18
Thanks for pointing out this thread - it is the same setup. I could use the sidebarAdaptable style to consolidate the two views, but I'd like to preserve the custom view in the List in the sidebar if possible. I don't think you can do this with TabSections.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’24
Reply to Using the same widget extension for both iOS and WatchOS
There is a walkthrough in the WWDC22 session Complications and widgets reloaded which suggests duplicating your existing Widget target, modifying the base SDK and embedding it in the watch app to achieve this using the same code.
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jul ’23
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
Reply to Using stringsdict to manage plurals in AppIntents
Thanks! A separate table has worked nicely.
Replies
Boosts
Views
Activity
Apr ’23