Questions tagged [swiftui-tabview]

For questions about TabView - a component in Apple's SwiftUI framework that switches between multiple child views using interactive user interface elements. When using this tag also include the more generic [swiftui] tag where possible.

Links:

  • Apple Developer Documentation for TabView.
325 questions
0
votes
1 answer

SwiftUI TabView does not show edit button in More menu

Having more than 5 tabs in a TabView adds a More tab, which contains the tabs that could not be fit on the tab bar. In UIKit, UITabBarControllers also have this functionality and additionally have a built-in edit button as the right nav bar item,…
Mr_Ripman
  • 1
  • 1
0
votes
0 answers

How to set a different background color for a specific tab in the TabView?

I want to change the background color of the tab bar only when a specific tab is selected, while keeping the default background color for the other tabs. Is this possible with the default TabView, or do I need to create a custom tab bar?
nitnatsnoK
  • 57
  • 2
  • 4
0
votes
0 answers

SwiftUI: The Tabview whose indexDisplayMode is never cannot be displayed correctly when there are more than 3 subpages

In order to adapt to Arabic, I need the view to be displayed from right to left. But in this case, when tabViewStyle is PageTabViewStyle(indexDisplayMode: .never), and there are more than 3 subpages, Tabview cannot switch pages normally. I switch…
GorCat
  • 174
  • 3
  • 11
0
votes
2 answers

State objects inside the SwiftUI views of a Custom tab bar is resetting

I am building a custom tab bar in SwiftUI. The views are attached to tab bar buttons and load without any issues. But the data stored in the @State variable in the screen resets while tapping on the button. struct ContentView: View { @State var…
0
votes
0 answers

SwiftUI: TabBar inside of a split NavigationView?

I have an iPad app I am writing with SwiftUI. I would like to have a split NavigationView with the left-hand (navigation) side displaying a TabView and the right-hand (content) side displaying other various views. I am seeing some strange…
Shadowman
  • 11,150
  • 19
  • 100
  • 198
0
votes
1 answer

Static method 'buildExpression' requires that 'MyApp' conform to 'View'

I'm trying to preview my music player app (specifically, trying to view a "Now Playing" bar above a tab bar). I am getting the error "Static method 'buildExpression' requires that 'MyApp' conform to 'View'" in response to the last line of the code…
hmn70
  • 1
0
votes
0 answers

SwiftUI TabView with 3 tabs, 2nd tabview renders only occasionaly

In this SwiftUI example, there is a TabView with 3 tabs. Tab A and tab C are always shown when the tab title is tapped. However clicking on tab B only shows the contents about 10% of the time. I'm using Xcode Version 14.3 (14E222b) and Swift 5.…
John Cashew
  • 1,078
  • 2
  • 12
  • 28
0
votes
0 answers

SwiftUI using TabView for Sidebar navigation, but there's still invisible TabBar at the bottom

I'm writing my own SideBar which utilises the TabView function to call on different views when the corresponding title in SideBar is tapped. This works pretty well. However, I've noticed that there seems to be an invisible TabBar on the bottom of…
0
votes
2 answers

SwiftUI: Profile with nested scroll views like Twitter or Instagram

I'm trying to create a profile screen similar to Twitter or Instagram, where there is a header with a floating tab bar around halfway down the page, and selecting different tabs switches the page of content underneath. The tricky part is that the…
Grambo
  • 887
  • 8
  • 25
0
votes
0 answers

How to hide the TabView's Toolbar on macOS

I would like to remove the toolbar of a TabView on macOS. Is it possible and how? My code: struct ContentView: View { @State var selectionIdx = 0 var body: some View { VStack { HStack { Button(action: { …
Fab
  • 1,468
  • 1
  • 16
  • 37
0
votes
1 answer

NavigationStack in TabView causing changes to header space in child views

When I put a NavigationStack in a TabView in SwiftUI, the child views have improper spacing at the top of each view. This only happens when I move to another tab and return back. Also it only occurs when I initialize TabView with TabView(selection:…
0
votes
0 answers

TabView where one of the tabs is a ScrollView is glitchy?

I'm having some weird glitches when trying to have a ScrollView as one of my tab-views. This is my sample code: import SwiftUI struct ContentView: View { // hack to set unselected tab item color init() { …
irrbloss
  • 207
  • 2
  • 9
0
votes
0 answers

SwiftUI TabView visible when first running app but not after switching to a different view and returning

When I first open my app, I see the TabView in a view (the MainView) as expected, but after switching to a different view, based on a ModeController class I created (which really just holds a boolean value and is observable) and then coming back, it…
lcj
  • 1,355
  • 16
  • 37
0
votes
1 answer

TabView with wide images

Can you please tell me if there is a way to scroll through wide pictures normally? Without scrolling the part that doesn't fit on the screen? Here is an example code: import SwiftUI struct ContentView: View { var body: some View { …
0
votes
0 answers

How to get Table content size in swiftUI

How can I get Table content size? GeometryReader { proxy in Table(self.viewModel.session.records, sortOrder: self.$order) { TableColumn("Id", value: \.id) TableColumn("Name", value:…
Sargis
  • 33
  • 8