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
3
votes
1 answer

Toolbar items not hiding / disappearing when TabView selection is changed on macOS

The same code runs perfectly on iOS, and the behaviour is as expected where whenever the tabview selection is changed, the toolbar items are updated accordingly. On macOS, the toolbar items do not disappear. import SwiftUI struct ContentView:…
Navan Chauhan
  • 397
  • 6
  • 14
3
votes
0 answers

Performance issue when using .sheet modifier with Map embedded inside TabView

I want to display a sheet on top of a Map in SwiftUI. The following is a simplified example: class ItemAnnotation: NSObject, MKAnnotation { private(set) var coordinate: CLLocationCoordinate2D init(coordinate: CLLocationCoordinate2D) { …
finebel
  • 2,227
  • 1
  • 9
  • 20
3
votes
2 answers

`TabView` and `tabViewStyle(.page)` not navigating as expected

I've been experimenting with TabView and tabViewStyle and I've run into a problem with my code I can't figure out. In the code below, when the app opens up on my device I start on the HomeScreen() (as expected) but if I tap on Profile in the top…
ragavanmonke
  • 409
  • 3
  • 13
3
votes
1 answer

How to switch between tabBar and toolbar swiftUI?

In the files App after you pressed the Select button the tabBar switch to the toolbar. How can I do this with swiftUI?(Switch between tabBar and toolbar) struct tabBar: View { var body: some View { TabView { …
fdvfarzin
  • 1,107
  • 1
  • 4
  • 14
3
votes
1 answer

SwiftUI TabView accentColor(:_) deprecated

I have a tabView and I'm trying to change it's color. Using accentColor(:_) works but it's going to be deprecated. TabView { AppetizerListView() .tabItem { Image(systemName: "house") …
paalma
  • 81
  • 7
3
votes
2 answers

SwiftUI Tabbar disappears when List touches Tabbar

I'm trying to create a List from a TabView using SwiftUI. But when the List touches the tabbar, the tabbar becomes transparent. If I use ".frame" to limit the size of the List so that the List doesn't touch the tabbar, it works properly. Why does…
hoeeeeeh
  • 77
  • 5
3
votes
1 answer

SwiftUI View Switch Statement Causes TabView to Reset

I am using a switch statement in a SwiftUI view: struct OnOffSwitchView: View { @ObservedObject var vm = ViewModel() var body: some View { switch vm.state { case .on: OnView(vm: vm) case .off: …
devok
  • 352
  • 1
  • 3
  • 9
3
votes
3 answers

SwiftUI Matched Geometry Effect not working with multiple ForEach's

I am basically trying to recreate the photos app. In doing so, matched geometry effect should be the best way to recreate the animation that is used in the photos app when you click on an image/close it. However, on opening of an image it only does…
Trevor
  • 580
  • 5
  • 16
3
votes
1 answer

Swiftui NavigationView + TabView doesn't show navbar item

I have four Views inside a TabView and each of them contains NavigationView with title. However, when the view first shows up, the navigation view does not show as designed. Even though I have the navigation bar item, the view would always be a…
cc nn
  • 115
  • 1
  • 1
  • 7
3
votes
0 answers

TabView changes selection even with empty custom handler

The code below changes the selection variable. Why? I thought a custom handler allowed me to intercept everything. The behavior I expect is for nothing to happen when I press a tab item. But what it does is set the selection variable and change the…
Bjørn Olav Jalborg
  • 373
  • 1
  • 3
  • 14
3
votes
2 answers

Custom Tab Bar with variable number of tabs in SwiftUI

I'm trying to replicate the tab bar in the iPad version of Safari, which looks like this: (Is there a third party library which does this? I can't find one) I'm using the code below. Which results in this: I guess I need to turn the Views into…
cannyboy
  • 24,180
  • 40
  • 146
  • 252
3
votes
0 answers

.tabViewStyle with animated swiping of tabs

Is it possible somehow to use the .tabViewStyle(.page) for animating swiping between tabs but with a look as the default style? Basically I want the animated tab swiping but not the tiny centered tab icons that comes as a side effect of using .page…
CaptainMJ
  • 167
  • 9
3
votes
1 answer

SwiftUI Toolbar In a TabBar View

My first view has a NavigationView with a Tab Bar View struct TestView: View { var body: some View { NavigationView { TabTestView() } } } In the Tab Bar, I have two views, say TestView1 and TestView2. struct…
3
votes
2 answers

SwiftUI: NavigationView inside TabView height not occupying the fullscreen

I seeing an unexpected UI issue in my SwiftUI project when I add a NavigationView inside a TabView. Here's my code, struct MainView: View { @State private var selectedTab: Int = 0 var body: some View { TabView(selection:…
3
votes
2 answers

Disable or ignore taps on TabView in swiftui

I have a pretty usual app with a TabView. However, when a particular process is happening in one of the content views, I would like to prevent the user from switching tabs until that process is complete. If I use the disabled property on the TabView…
Hoopes
  • 3,943
  • 4
  • 44
  • 60
1 2
3
21 22