How to use NavigationView in a DocumentGroup on iPad

I am building a DocumentGroup-based app and want to use the iPad behavior for its containing NavigationView.

I need to keep the functionality "<" from the navigation view provided by the Document Group to allow the user to move between files. At the same time, I need to support the 'sidebar' behaviors in the main app for the user to navigate between components of the app.

Any ideas on how to do this?

An image of this (with annotation) is at: GitHub at /cwoloszynski/appleforums/master/Document%20Navbar%20Issue.png

Replies

You might need to fallback to using the old UIKit App Delegate life cycle type instead of the newer DocumentGroup. With the old pattern, you are totally responsible for presenting the document view after the user selects a document. That gives you more control. With DocumentGroup, you only provide your content which DocumentGroup then embeds in it’s own view hierarchy. I have found that DocumentGroup doesn’t provide all the flexibility that was previously available. I’m hoping it will in the future, but for now, I’m avoiding it.
Using Reference File Document Group followed by NavigationView I've been able to have a document group that open a navigation view, which have the sidebar.
Here an extract:
Code Block
import SwiftUI
@main
struct MyApp: App
{
var body: some Scene
{
DocumentGroup(newDocument:
{ () -> myDocumentClass in // Create a new document
return myDocumentClass()
},
  editor:
{ (file: ReferenceFileDocumentConfiguration<myDocumentClass>) -> ContentView in
return ContentView()
}
)
}
}
class myDocumentClass: ReferenceFileDocument
{
typealias Snapshot = ContentView
var myData: Snapshot
...
}
struct ContentView: View
{
var body: some View
{
NavigationView
{
sideBar()
mainView()
}
.navigationViewStyle(DoubleColumnNavigationViewStyle())
}
}