I developing a swiftUI app for macOS. I like the side bar very much. It shows up on the left and I can add a button to open and close it. All this is good. However, I also like a similar panel on the right, so it can serve as an 'inspector' to the content I am editing.
It looks like a right sidebar may not be supported in SwiftUI. So, I tried the following:
NavigationView() {
// Sidebar
VStack(alignment: .leading) {
// My sidebar views here
}
.frame(minWidth: 200, idealWidth: 220, maxWidth: 240)
// Main Content
VStack {
ScrollView {
LazyVGrid() {
// My Grid view here
}
}
}
// Inspector View
VStack(alignment: .leading) {
// Inspector views here
}
.frame(minWidth: 200, idealWidth: 220, maxWidth: 240)
}
My desire was for the Inspector view will be snapped to the right and the main content to fill the center space. The above layout doesn't do that. Instead, the inspector view appears much wider and the main content shrunk.
I can use the divider to resize it accoding to my need. But would love for it to appear as desired on startup.
Is there any other way or workaround I can explore to achieve this?