0

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.

enter image description here

enter image description here 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

enter image description here


Apple Example project:

enter image description here

My project:

enter image description here

János
  • 32,867
  • 38
  • 193
  • 353
  • 1
    I would assume that you wouldn't want the "designed for iPad" selected – jnpdx Aug 01 '23 at 15:29
  • Yes, true, would you look at the last two screen shot. How is that Apple example project has no `Device for iPad` but in my project only this option exist? – János Aug 01 '23 at 16:21
  • 1
    Because when you added the target, you added it as "designed for iPad" – jnpdx Aug 01 '23 at 16:39
  • Would you look at this also: https://stackoverflow.com/questions/76816909/how-to-make-visionos-available-in-xcode-beta – János Aug 02 '23 at 05:39
  • Have you face with these challenges maybe? https://stackoverflow.com/questions/76817570/how-to-add-realitykitcontent-to-an-existing-swiftui-app https://stackoverflow.com/questions/76817663/will-tabview-not-be-visible-if-realitykitcontent-is-not-imported-in-swiftui-app – János Aug 02 '23 at 07:52

0 Answers0