TabView on IPAD (IOS18.1)

Dear friends,

I am trying to use IOS18 API for TabView. Below code works well on simulator Iphone 16 Pro Max. But, it failed to show UI on simulator Ipad Pro 13 .

    TabView(selection: $selectedTab) {

        Tab("Test1", systemImage: "bubble.left.and.bubble.right", value: .translation) {
            TestViewOne()
  
        }
        

        Tab("Test2", systemImage: "character.textbox", value: .ruby) {
            TestViewTwo()
        }
        
        Tab("Test3", systemImage: "person.crop.circle", value: .browser) {
            TestViewThree()
        }
    }

There are 3 tabs, none of them can show the view (TestViewOne TestViewTwo TestViewThree ) until pressing button 4 (red 4 in the attached image). The view could show in the sidebar area instead of normal UI area, Is there any suggestions for this?

thank you very much!

Accepted Answer

Dear all,

this issue can be fixed by add modifiers below:

    .tabViewStyle(.automatic)
    .environment(\.horizontalSizeClass, .compact)

BR

TabView on IPAD (IOS18.1)
 
 
Q