I'm working on an iPad app where I will have three views inside a single NavigationView
to provide the 3-way split screen found in native apps (Notes) on horizontal mode. See the screenshot below as an example.
A particular behaviour that I found to be interesting is when I click on an item in the Folders
View. The entire Folders
View collapses to the side when I do. See the following gif for an example of the behaviour that I found to be eyecatching (Here, I press on the React native
Item).
I want to replicate this behaviour using SwiftUIs NavigationView
but haven't managed to so far. I've tried many solutions in this thread about closing/popping a View in the navigation stack, but none of them works.
You can find the code I have prepared below with a gif representing how it looks as of now
struct ContentView: View {
var body: some View {
NavigationView {
VStack {
Button("Close First") {
// Close the View
}
}
.navigationTitle("First")
Text("Second")
.navigationTitle("Second")
Text("Third")
.navigationTitle("Third")
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
.previewDevice("iPad mini (6th generation)")
.previewInterfaceOrientation(.landscapeLeft)
}
}
GUI:
Any help would be appreciated, TIA.