I am working on a SwiftUI app with a TabView that includes a custom sidebar and content split view. The app is designed for VisionOS. According to the VisionOS documentation and my research, the TabView's default behavior on an iPad in landscape orientation should place the tab bar on the left side, while on smaller devices like iPhones, it should be at the bottom.
However, I am experiencing inconsistent behavior in the VisionOS simulator. In the VisionOS "helloworld" app, the tab bar appears on the left side as expected. However, when integrating the same code around my existing SwiftUI app, the tab bar appears at the bottom, despite the fact that I am running the app on an iPad in landscape orientation in the VisionOS simulator.
Here is the relevant part of the SwiftUI code:
// ContentView.swift
import SwiftUI
import RealityKit
import RealityKitContent
struct ContentView: View {
// ... (existing code)
var body: some View {
TabView {
// ... (existing code)
}
}
}
Can someone please explain why the default behavior of TabView is not consistently placing the tab bar on the left side in the VisionOS simulator, and what steps can be taken to ensure the tab bar is consistently on the left side, as expected in an iPad landscape orientation?
I have added visionOS
as target
Apple Example project:
My project: