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 display only the Detail View, and the second one should be with list of ContentView and Detail View.
NavigationSplitView Interfaces Image
The problem is that sometimes this causes the views to overlap.
import SwiftUI
struct ContentView: View {
var body: some View {
NavigationSplitView {
List {
NavigationLink("First View") {
FirstView()
}
NavigationLink("Second View") {
SecondView()
}
}
.navigationTitle("Sidebar")
} detail: {
Text("Details")
.navigationTitle("Detail")
}
}
}
struct FirstView: View {
var body: some View {
Text("First View Detail")
.navigationTitle("First Detail")
}
}
struct SecondView: View {
var body: some View {
NavigationSplitView {
List {
NavigationLink("First View") {
FirstView()
}
NavigationLink("Second View") {
SecondView()
}
}
.navigationTitle("Sidebar")
} content: {
Text("Second View Content")
.navigationTitle("Second Content")
} detail: {
Text("Second View Detail")
.navigationTitle("Second Detail")
}
}
}
Question. How do I create an application where there is a two and three-column interface?