每次导航到另一个屏幕时,我都会在控制台中收到此消息:
[Assert] displayModeButtonItem is internally managed and not exposed for DoubleColumn style. Returning an empty, disconnected UIBarButtonItem to fulfill the non-null contract.
Run Code Online (Sandbox Code Playgroud)
目前我在应用程序的入口点设置了导航视图,就像这样
NavigationView {
KeyboardView(matrixVM: matrixVM, isNavigationBarHidden: $isNavigationBarHidden)
.background(Color("background")
.edgesIgnoringSafeArea(.all))
.navigationBarTitle("Workspace")
.navigationBarHidden(self.isNavigationBarHidden)
.onAppear {
self.isNavigationBarHidden = true
}
}
Run Code Online (Sandbox Code Playgroud)
然后在 KeyboardView 里面我有导航链接
NavigationLink(destination: NotebookView(isNavigationBarHidden: $isNavigationBarHidden, saved: matrixVM), label: {
Text("Notebooks")
.font(.system(size: 14, design: .rounded))
.fontWeight(.medium)
.foregroundColor(Color("text"))
.padding(.trailing, 10)
})
Run Code Online (Sandbox Code Playgroud)
在 NotebookView 中,我有一个导航链接列表(每个笔记本链接到其详细信息页面)
ScrollView(showsIndicators: false) {
ForEach(notebooks, id: \.self) { notebook in
NavigationLink(destination: ExpandedSnippet(matrixVM: saved ,notebook: notebook)
.navigationBarTitle("Notebook", displayMode: .inline)) …Run Code Online (Sandbox Code Playgroud)