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
2
votes
3 answers

Is there a way to disable TabItems in a TabView similar to .disabled() on Buttons in SwiftUI?

I have a TabView with three TabItems. When I press a Button on the first TabItem, I then want to disable the user's ability to tap and go to TabItem two and three. I've used disabled(), but I can still tap and go to them. TabView(selection:…
Dince-afk
  • 196
  • 7
2
votes
1 answer

How to swap TabView items in SwiftUI?

import SwiftUI struct DashboardTabBarView: View { @State private var selection: String = "home" var body: some View { TabView(selection: $selection) { Color.red …
Rehan Ali Khan
  • 527
  • 10
  • 23
2
votes
1 answer

Disable to Change Page On Swipe of Tab View in SwiftUI

I am using Tab View in my SwiftUI app. I want the changing of page disabled, while swiping left or right. And I had achieved it from this. This works fine but the issue I am facing is I have a button on the bottom of every view, and when I try to…
Taimoor Arif
  • 750
  • 3
  • 19
2
votes
1 answer

Making TabView Icons a specific color in SwiftUI

I have a tab bar whose icons I am trying to make white, however despite the fact that I am specifying the color, the icons remain grey for some reasons (despite me never actually setting them to grey). The code is shown below - struct…
2
votes
1 answer

Automatic slide switching (SwiftUI)

I can not understand why the timer does not work, and the text does not scroll automatically. I tried to do so: ForEach(0..
user17967018
2
votes
2 answers

Stack Hides Behind Tab Bar in SwiftUI

I am new to SwiftUI and using a tab bar. Inside my tab bar there are 4 views, of which I made different class for each. Now I am using a VStack for the rectangles but these rectangles hide behind the tab bar. I am attaching screenshot for this: and…
Taimoor Arif
  • 750
  • 3
  • 19
2
votes
0 answers

SwipeAction does not work in TabView SwiftUI

I have List in the TabView. List has text/button with delete and update swipe action. The swipe action does not work in the tabview but it is work fine without tab view. Below is my code. TabView { List { ForEach(0..<5, id: \.self)…
2
votes
1 answer

SwiftUI NavigationView nests TabView auto pop

NavigationView nests TabView, I have a List, and push to the next page When the application returns to the background and returns to the active state, the push page automatically pops up. If TabView nests NavigationView, there will be no problem,…
gaohomway
  • 2,132
  • 1
  • 20
  • 37
2
votes
2 answers

How to pass in content for TabView through a function

I am trying to build a reusable onboarding pager overlay. So I want to pass in different "slides" into the pager TabView based on a variable IntroType. But since TabView takes content plainly without any container, what would be the return type for…
Big_Chair
  • 2,781
  • 3
  • 31
  • 58
2
votes
0 answers

SwiftUI how to use .fixedSize() modifier with TabView to only take up the space it needs?

I have a TabView that is embeeded in a ZStack. My goal is to make the ZStack and it's child TabView to only take up the space needed to lay out the views inside the TabView. The .fixedSize() modifier accomplishes this if I change my TabView to a…
GarySabo
  • 5,806
  • 5
  • 49
  • 124
2
votes
1 answer

SwiftUI NavigationView nested in PageTabView wrong aligned on first appear

The NavigationViews inside my PageTabView are wrong aligned on first appear. When i scroll to another page on my PageTabView and go back to the first page, the alignment is correct. The content of the navigationview (red) is beneath the…
2
votes
1 answer

iOS 15 navigation bar transparency problem with TabView

New iOS 15 makes navigation bar background completely transparent if there is no element behind, if there is a List and you scroll the elements to be behind the navigation bar this obtains a white translucent background, but if I use a TabView where…
lcpr_phoenix
  • 373
  • 4
  • 15
2
votes
0 answers

Updating TabView Badge Reloads All Views when Using SwiftUI 3 .badge Modifier

I have a pretty standard TabView setup for my app. Everything works fine, but when I dynamically update the TabView badge count for the Notifications page, the entire view gets reloaded and I'm wondering if it's a bug, or if I'm possibly overlooking…
eResourcesInc
  • 948
  • 1
  • 9
  • 17
2
votes
0 answers

SwiftUI NavigationView Title Starting Lower

So I've got a NavigationView embedded inside of a TabView that is in the Page View Style. Upon the first load, the NavigationView will start with its title lower than where it should be. Once I reload the view, by going to a different tab, it resets…
2
votes
1 answer

SwiftUI NavigationView Starting Inside Itself

So I've got a NavigationView embedded inside of a TabView that is in the Page View Style. Upon first load the NavigationView will start inside itself, and then once reloaded it shows normally. I am unsure as to what is causing this. And I've made a…