I'm attempting something similar. Here's something basic I've come up with. It seems you can put multiple Views in the HSplitView (maybe up to 10?). I think you're supposed to get a toggle button to expose the sidebar for free, but I only see in it iPadOS, not macOS. See Hacking with Swift "how-to-add-a-sidebar-for-ipados".
var body: some View {
VStack {
Text("Items")
List(0..<16, id: \.self) { i in
Text("Item \(i)")
}
.listStyle(SidebarListStyle())
Spacer()
}
.frame( idealWidth: 250, maxWidth: 250, maxHeight: .infinity)
}
}
struct DetailPane: View {
var body: some View {
Text("Details")
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center)
}
}
struct InspectorPane: View {
var body: some View {
VStack {
Text("Inspector")
}
.padding()
.frame( idealWidth: 250, maxWidth: 250, maxHeight: .infinity)
}
}
struct ContentView: View {
var body: some View {
HSplitView {
MasterPane()
DetailPane()
InspectorPane()
}
}
}
Post
Replies
Boosts
Views
Activity
Maybe this is better. Wrap View into a NavigationView.
		var body: some View {
				NavigationView {
						MasterPane()
						HSplitView {
								DetailPane()
								InspectorPane()
						}
				}
		}
}
I am having a similar problem with Xcode 12.2. My extension seem to work elsewhere, but not in Text views.
I have this same problem in a macOS project. It seems if there are multiple items with .automatic placement, all but one are hidden. This seems to be either a bug or undocumented behavior. The documentation is highly unreliable. Some placement options like .navigationBarLeading and .navigationBarTrailing are stated to be available in macOS 11.0+ but the compiler produces an error ("'navigationBarLeading' is unavailable in macOS") when used. And using .principal placement usually has a runtime error and crashes.
Any help out there?