I'm using a two column NavigationSplitView, where the view passed for the detail column is the root of a NavigationStack.
The navigation works as expected, but the navigationTitle and toolbar elements of the detail view are very slightly delayed when the view appears on iOS, such that they 'pop' in rather than smoothly animating like normal. Returning to the root of the view from views higher in this stack animates as expected.
Has anyone seen anything like this before? Thanks!
The SwiftUI cookbook for navigation
RSS for tagDiscuss the WWDC22 Session The SwiftUI cookbook for navigation
Posts under wwdc2022-10054 tag
5 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
I'm trying to implement the same UI used by the Settings app on iPad: a split view with two columns that are visible at all times.
This code produces the layout i want, but I would like to hide the "toggle sidebar visibility" button that the system introduces.
Is there a SwiftUI API I can use to hide this button? Maybe an alternate way to setup views that tells the system that the button is not necessary?
struct SomeView: View {
var body: some View {
NavigationSplitView(
columnVisibility: .constant(.all),
sidebar: { Text("sidebar") },
detail: { Text("detail") }
)
.navigationSplitViewStyle(.balanced)
}
}
Any one getting any issues with NavigaitonLink to seemingly innocuous views freezing when tapped on? 1 CPU at 100% memory steadily increasing until app gets killed by the system. Will freeze if any NavigationLink on the view is tapped if certain views are linked to using NavigaitonLink.
I note some people have been getting similar freezes if they use @AppStorage, but I'm not using @AppStorage. I do use CoreData tho. tho I have some views that use core data that don't freeze.
https://developer.apple.com/forums/thread/708592?page=1#736374022
has anyone experienced similar issues? or know the cause. it doesn't seem to be any of my code because if I pause the debugger it stops on system code.
Overview
On macOS, in a NavigationSplitView when the menu button is added to the detail view toolbar, it seems to look disabled
Environment
Xcode: 14.1 beta 3 (14B5033e)
macOS: 13.0 Beta (22A5365d)
Code:
struct ContentView: View {
@State private var selectedNumber: Int?
var body: some View {
NavigationSplitView {
List(0..<100, selection: $selectedNumber) { number in
Text("cell \(number)")
}
} detail: {
Text("Detail")
.toolbar {
ToolbarItem {
Menu {
Button("aa") {}
Button("bb") {}
} label: {
Label("Add Bookmark", systemImage: "book")
}
}
}
}
}
}
Steps to reproduce:
Run the project on macOS
Select cell 0 on the sidebar
Click on the book toolbar button and notice the menu appear
Select cell 1 on the sidebar
Expected Behaviour
After step 4, the book toolbar button should look prominent (like it is enabled)
Actual Behaviour
After step 4, the book toolbar button looks like it is disabled.
Screenshot
I am currently learning to create multiplatform applications using SwiftUI and NavigationSplitView, and I faced the problem of arranging different Views in the same App.
Let's open the default Notes application, and here, we can see a switch between two and three-column views of the content.
So my question is, how to arrange this kind of view for different App pages using NavigationSplitView?
First page has two columns interface
Second has three columns