Questions tagged [swiftui-navigationsplitview]

Filter by
Sorted by
Tagged with
9 votes
3 answers
5k views

SwiftUI - Nested links within NavigationStack inside a NavigationSplitView not working

I'm playing around with the new navigation API's offered in ipadOS16/macOS13, but having some trouble working out how to combine NavigationSplitView, NavigationStack and NavigationLink together on ...
thiezn's user avatar
  • 1,966
8 votes
0 answers
299 views

NavigationTitle delay on iOS 16.1 when using NavigationSplitView

Is anyone else facing this issue with iOS 16.1 NavigationSplitView where the NavigationTitle loads after the view is loaded? – works fine on iOS 16.0. (https://i.stack.imgur.com/G0IUG.gif) It's ...
Christopher Fernandes's user avatar
6 votes
2 answers
1k views

How to run `task` or `onAppear` on NavigationSplitView detail for every selection change?

I'm trying to use NavigationSplitView with a DetailView that has a task or onAppear in it, but it seems it only runs once. enum MenuItem: String, Hashable, Identifiable, CaseIterable { case menu1 ...
ygee's user avatar
  • 2,950
6 votes
2 answers
4k views

SwiftUI 4: navigationDestination()'s destination view isn't updated when state changes

While experiments with the new NavigationStack in SwiftUI 4, I find that when state changes, the destination view returned by navigationDestination() doesn't get updated. See code below. struct ...
rayx's user avatar
  • 1,528
5 votes
2 answers
2k views

How to show in SwiftUI the sidebar in iPad and portrait mode

I have an master detail app in iPad, and when run the app in portrait mode the sidebar is hidden. I need to push Back button to open the sidebar. Can anyone help me to show the sidebar by default? I ...
Ivang's user avatar
  • 105
5 votes
2 answers
494 views

How to avoid rebuild view when tap on different button on NavigationSplitView

I have tried apple example Bringing robust navigation structure to your SwiftUI app so my code looks like this NavigationSplitView( columnVisibility: $navigationModel....
Basel's user avatar
  • 600
4 votes
1 answer
4k views

SwiftUI NavigationStack inside NavigationSplitView not working on iPhone and iPad

I'm trying to use NavigationStack inside NavigationSplitView. struct ContentView: View { @State var mainMenu: MenuItem? @State var subMenu: SubMenuItem? var body: some View { ...
ygee's user avatar
  • 2,950
4 votes
1 answer
4k views

New NavigationStack in SwiftUI transition, how to change from the default slide to custom or appear?

I have NavigationStack with its own navigation links, for iOS16 development. How to change the default slide transition to appear or a custom transition? Also do you apply the transition on the ...
Pro Girl's user avatar
  • 882
4 votes
1 answer
750 views

SwiftUI: How to update detail column from a distant child using iOS16/iPadOS16 NavigationSplitView and NavigationLink

I'm trying to update an older app to use the new NavigationSplitView and NavigationLink, but trying to wrap my head around the proper way to do it when the sidebar has a hierarchy of child objects and ...
tharris's user avatar
  • 2,232
4 votes
1 answer
1k views

SwiftUI 4: Is it OK to make multiple .navigationDestination() calls at different levels in view hiearchy?

I wonder if it's OK to call navigationDestination() multiple times at different levels in the view hierarchy? I googled but all the examples I found on the net called it on the top level view within ...
rayx's user avatar
  • 1,528
4 votes
1 answer
830 views

SwiftUI NavigationSplitView on iPad: remove accent from selected item in Sidebar

I am adopting NavigationSplitView for an app to be used on an iPad as well as on an iPhone. In my code below, I want to highlight the the selected item in the Sidebar only with the word "Selected&...
HunterLion's user avatar
  • 3,768
4 votes
0 answers
1k views

NavigationSplitView on macOS: OutlineGroup Elements in Sidebar not selectable

I have a simple Example of NavigationSplitView with different types in the Sidebar, including an OutlineGroup. Problem: OutlineGroup's parent nodes are selectable, child nodes (leafs) are not. Nodes ...
ChrisR's user avatar
  • 11.1k
3 votes
0 answers
338 views

SwiftUI NavigationSplitView column visibility on iPhone?

I'm trying to create a 3-column layout in SwiftUI. The first column is a LazyVGrid of selectable items. The selection then impacts a list of items in a content view (second column) which also isn't a ...
guycas's user avatar
  • 61
2 votes
1 answer
974 views

onDelete Does not Reliably Delete List Items in SwiftData NavigationSplitView

I'm building a new version of an app with SwiftData and am having issues with list deletions in iPad landscape mode. When deleting items, the deleted item randomly reappears as though not deleted from ...
JohnSF's user avatar
  • 4,060
2 votes
1 answer
588 views

UICalendarView vs SwiftUI DatePicker wrong size in NavigationSplitView sidebar

Because i need to add badges to certain dates, i need to use a UICalendarView representable, however when using this in the NavigationSplitView sidebar, the width of the UICalendarView is incorrect... ...
Peter Lapisu's user avatar
  • 20.5k
2 votes
1 answer
219 views

Detail view of NavigationSplitView partially works

I wrote a sample app (for macOS) which contains 3 users. I use NavigationLink for each users in a NavigationSplitView. When NavigationLink of any user is clicked the detail view should show the user ...
Louie88's user avatar
  • 45
2 votes
1 answer
248 views

NavigationSplitView toolbar in fullscreen does not display background image

MacOS application built using SwiftUI. I am replicating a transparent background for NavigationSplitView by setting a background image for the detail and sidebar views. //NavigationSplitView ...
mikechambers's user avatar
  • 3,069
2 votes
1 answer
643 views

Does anybody have a working NavigationSplitView with NavigationStack in Details View?

No matter how it is set up, a complex 3 Columns NavigationSplitView with NavigationStack crashes or has inconsistent workflow. Sidebar selection determines which content (or feature) is in Content. ...
GeorgeJ's user avatar
  • 186
2 votes
1 answer
2k views

Is there any way to make NavigationSplitView's side bar with clear background?

I am trying to make side bar in NavigationSplitView with clear background for side bar, so that detail view is visible under sidebar when it is open.In UIKit it is possible to make, when iPhone in ...
Анна Овчинникова's user avatar
2 votes
0 answers
237 views

Persist navigation paths in NavigationSplitView with NavigationStacks

I have an SwiftUI iOS app that uses TabView to display 4 different NavigationStacks. Each stack can be navigated into. To make this app work better on iPad OS I'd like to use a NavigationSplitView ...
Sebastian's user avatar
  • 2,905
2 votes
1 answer
300 views

Create a NavigationSplitView on macOS with transparent background?

Working on macOs 14 with SwiftIU, and have a NavigationSplitView. I want to set its background to be transparent. I am basically trying to recreate the look of the Apple Home app: Using the Swift ...
mikechambers's user avatar
  • 3,069
2 votes
0 answers
168 views

NavigationSplitView resetting when app enters background

I've been trying to build an app using NavigationSplitView and SwiftUI on iOS 16. I noticed that as soon almost as the app enters the background (sometimes I have to wait a few seconds before ...
user2898617's user avatar
2 votes
0 answers
369 views

NavigationSplitView detail not updating

Why does the button "Show second view" not work here? struct ContentView: View { @State private var showSecondView = false var body: some View { NavigationSplitView { ...
John's user avatar
  • 1,092
2 votes
0 answers
266 views

NavigationSplitView navigates to last selected item when leaving edit mode

I have a NavigationSplitView and an EditButton in the same ContentView. Both do what they should, except that when I click "Edit" and then "Done", the detail view of the last ...
Stefan Berger's user avatar
2 votes
0 answers
276 views

Toolbar Menu button seems to look disabled

Overview On macOS, in a NavigationSplitView when the menu button is added to the detail view toolbar, it seems to look disabled (refer to steps to reproduce) Question: Is there a way to not look ...
user1046037's user avatar
  • 17.2k
2 votes
0 answers
604 views

Using a two and three column interface in SwiftUI NavigationSplitView app

Now I am developing an application and faced with the problem of having to display two and three-column interfaces within the same application. Let's say that I have two views. The first one should ...
user3174610's user avatar
1 vote
1 answer
1k views

NavigationSplitView not updating

Can someone please help me why the NavigationLink is not working as intended? As shown down below (in the code) I use the MarkdownWebView(url: <url>) with 3 different URL’s. But when I want to ...
luegm.dev's user avatar
  • 141
1 vote
1 answer
780 views

Where does the navigation destination go in an iOS 16 NavigationSplitView?

I've found this great video from Sean Allen https://www.youtube.com/watch?v=oxp8Qqwr4AY on having two different structs in a NavigationStack, but I cannot figure out how to make this work if I am ...
Rillieux's user avatar
  • 607
1 vote
1 answer
42 views

NavigationSplitView - having a .sheet in the detail view breaks in compact/iPhone mode

I'm trying to get a NavigationSplitView working where on the iPhone in compact/portrait mode when you go to the detail view there is a '.sheet' that is available only on that view, and when you ...
syp5w2qxe's user avatar
  • 113
1 vote
1 answer
44 views

preferredCompactColumn is being passed as NavigationSplitViewColumn.sidebar but still seeing details page on iOS

As we can see in the code preferredColumn is set to NavigationSplitViewColumn.sidebar but when I open this app in iPhone 15 pro preview the NavigationSplitViewColumn.detail is shown and then user have ...
Manoj Singh Negi's user avatar
1 vote
1 answer
193 views

Control NavigationLink in NavigationSplitView from multiple places (List and Picker)

I have a list within a NavigationSplitView. The list has NavigationLinks, which when selected, load a detail view: List(selection: $selectedMode) { ForEach(modes, id: \.self) { modeInfo in ...
mikechambers's user avatar
  • 3,069
1 vote
1 answer
122 views

NavigationSplitView works with .ID not with Object(struct)

In my project I want to navigate to the detail View in a NavigationSplitView. This however does not work, nothing happens. When I change the selection to the ID property all of it works. I made a very ...
DeveloperSammy's user avatar
1 vote
1 answer
145 views

NavigationLink selected state area is larger than the underlying view

I'm using a NavigationSplitView with two columns for a macOS app. The sidebar column shows a list of items and the right pane shows the details for the selected item. I'm using NavigationLink to ...
Mete Polat's user avatar
1 vote
1 answer
270 views

SwiftUI - Unable to navigate to next View from List/NavigationLink with navigationDestination

My first View represents a login screen, which then takes you to the home View. I've read through the documentation and watched WWDC22 - The SwiftUI cookbook for navigation which got me on the right ...
Joe G's user avatar
  • 93
1 vote
1 answer
226 views

How to unmute colors in SwiftUI's NavigationSplitView sidebar

I am using NavigationSplitView, introduced in iOS16, with a basic list and attempting to color a system image with standard colors. I am noticing that when the navigationSplitViewStyle is .automatic ...
stanlemon's user avatar
  • 409
1 vote
0 answers
59 views

Appear Circles in ZStack exact image position as navigationSplitView (.balanced) opens or close

struct Animal: Hashable { let name: String let description: String } struct ContentView1: View { let animals = [ Animal(name: "Coyote", description: "The coyote is ...
Muhammad Zubair Ghori's user avatar
1 vote
0 answers
63 views

How to navigate from NavigationSplitView to new view opened full screen

I want to ask for help with NavigationSplitView for iPad app. My idea is to have NavigationSplitView where I can display some filters/sections on the left side and list of objects on the right side (...
metal_man's user avatar
  • 600
1 vote
1 answer
60 views

NavigationSplitView crashes if I select an item in the sidebar after I removed other items

My NavigationSplitView crashes if I select an item in the sidebar after I removed other items: Thread 1: EXC_BREAKPOINT (code=1, subcode=0x1c44d488c) How to reproduce: Launch the app from the ...
alpennec's user avatar
  • 1,954
1 vote
0 answers
237 views

NavigationSplitView: Hide detail column in a three-column view

I am creating a macOS app using SwiftUI, creating a three-column layout with NavigationSplitView. It seems that the sidebar (or first column, or leading column) is able to be hidden by default. I ...
muse-hemlock0m's user avatar
1 vote
1 answer
88 views

Why do push animations break after switching list data in NavigationSplitView sidebar?

I have a complex-ish sidebar in my NavigationSplitView where I'm letting the user switch between two kinds of list data using a picker in the toolbar. Unfortunately, I've run into an issue where the ...
rizz's user avatar
  • 11
1 vote
0 answers
75 views

Switching between two `NavigationSplitView's breaks the titlebar/toolbar on macOS

My macOS! app has a picker menu in the toolbar to switch between different views. If I try to switch from one view including a NavigationSplitView to another one of that kind, the menu title / tool ...
ChrisR's user avatar
  • 11.1k
1 vote
1 answer
195 views

In SwiftUI, how do I pass a a NavigationSplitViewVisibility to a subview?

My app uses a NavigationSplitView to provide a 3 column (sidebar, content, detail) layout. The sidebar is implemented in one view (SideBarView). The content view is implemented in a separate view (...
Carter's user avatar
  • 4,748
1 vote
0 answers
77 views

NavigationSplitView with collapsable List and CoreData

I am trying to set up a collapsible List in my Core Data backed macOS app to allow navigation in the side bar. Project is the main entity and has a to-many relationship with File. It should look ...
koen's user avatar
  • 5,615
1 vote
0 answers
876 views

Path of NavigationStack inside NavigationSplitView emptied on change

I have the following view inside WindowGroup: struct SidebarSelection: View { @State var selection: Int? @State var path: [Int] = [] var body: some View { ...
Dominik's user avatar
  • 746
1 vote
1 answer
166 views

SwiftUI TextField mysteriously breaks navigation animation when used with NavigationPath

MRE enum HomeDestination: Int, CaseIterable, Hashable, Identifiable { case a var id: Int { rawValue } var name: String { switch self { case .a: return "A" ...
erotsppa's user avatar
  • 14.7k
1 vote
0 answers
357 views

SwiftUI TabView NavigationSplitView

I have a TabView with four tabitems which destinations are four NavigationSplitView. The Sidebar button is repeating for the four NavigationSplitViews on macOS like on below display. On iPad it works ...
JYF97411's user avatar
0 votes
2 answers
694 views

NavigationStack inside NavigationSplitView detail in SwiftUI

I have a typical NavigationSplitView layout in my app: NavigationSplitView { List(0..<3, selection: $selection) { item in Label(MainDataType.data[item].name, systemImage: MainDataType.data[...
arroyot24's user avatar
0 votes
1 answer
705 views

Saving the current width of a NavigationSplitView sidebar in SwiftUI

I'm making a macOS app in SwiftUI with the new NavigationSplitView. If a user resizes the sidebar, I'd like that new width to be remembered and restored when the app next loads. A preference can be ...
Ian's user avatar
  • 45
0 votes
1 answer
288 views

SwiftUI 4: How to not expose internal views when using NavigationStack?

Suppose I'm working on a calendar library in SwiftUI 4. The calendar has a button for user to select a month. When user clicks on that button, it navigates to a view which lists all the months for ...
rayx's user avatar
  • 1,528
0 votes
1 answer
1k views

Is it possible to start the NavigationSplitView in an expanded state on macOS using SwiftUI?

I like the sidebar to be opened at launch. However when I build and run the app, this is what I get. So I need to click on the sidebar icon to show it. This is not the behavior I want. Is it possible ...
Mark's user avatar
  • 17.6k