I'm using SwiftUI to set up a 3-column navigation view with a sidebar for iPadOS and a TabView for iOS.
However, I'm unable to get the sidebar functionality with the sidebar toggle icon in the 3 column view. As soon as I switch to 2 column view, I get the sidebar toggle icon automatically. But it disappears in 3 column.
Here's the missing icon in 3 column view:
And here's the toggle icon with the same code when I switch to 2 column view:
Here's the code:
struct MainView: View {
var body: some View {
if UIDevice.current.userInterfaceIdiom == .phone {
TabBarView()
} else {
NavigationView {
Sidebar()
Text("1")
Text("2")
}
}
}
}
How do I get the sidebar toggle icon to appear in the 3 column view? Note that the toggle icon that is provided by SwiftUI automatically appears on sidebar and primary view on being collapsed and expanded, which is the functionality I'm looking for (example: In contacts or mail app on the iPad).

