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
1
vote
0 answers

SwiftUI passing TabView binding variable around in global EnvironmentObject

I've got a SwiftUI issue that only surfaces in a complex scenario. My application has a TabView near the top of the view structure. There are 5 tabs in total. Tab 1 and 5 are pretty simple ScrollView type views called Home and Account. Tabs 2,3,4…
Stanton
  • 904
  • 10
  • 25
1
vote
1 answer

How to hide keyboard when closing sheet swiftui

I have place picker sheet and whenever I select a place the keyboard remains stuck on the main screen, I can t hide my place picker view: struct PlacePicker: UIViewControllerRepresentable { func makeCoordinator() -> GooglePlacesCoordinator { …
user20810748
1
vote
0 answers

SwiftUI page tabViewStyle view animation does not work

I am trying to animate on a view’s onAppear method in a tabView, but the next view’s onAppear also executed, when the previous view is just appearing. Seems like the TabView preloads the following page, which triggers the animation before the next…
Wolfer
  • 11
  • 2
1
vote
0 answers

Minimize or bring back sheet in SwiftUI

I have a Voip calling app using CallKit and when call received, it will open a view call IncomingView in a sheet in my SwiftUI app. So far so good. But i want to minimize the sheet and can navigate to other pages and preferably shows a green bar at…
SoftSan
  • 2,482
  • 3
  • 23
  • 54
1
vote
1 answer

NavigationStack inside TabView inside NavigationStack throws

I'm trying to migrate a coordinator pattern using UINavigationController into the new NavigationStack. The navigation flow is quite complex, but I've made a simple project to simplify it to this: NavigationStack -> MainScreen -> TabView …
Marco Scabbiolo
  • 7,203
  • 3
  • 38
  • 46
1
vote
1 answer

SwiftUI stocking geometry effects and tabBar animation

Hey guys I have some issues with my code. I just experimented a bit with the matchedGeometryEffect in SwiftUI and it works great. But now I ran into some issues: I cannot just deactivate the tabBar when the DetailView is dismissed because the view…
Noah
  • 21
  • 2
1
vote
2 answers

How can I make a bottom sheet appear behind a tabView?

Does anyone know how I can create a bottom sheet similar to the one in the Diary Queen app. I have tried a few times but every thing I've tried has made the bottom sheet appear above the bottom tabview. I need it to appear from behind the tabview…
k.arias
  • 11
  • 2
1
vote
2 answers

TabView is creating tabs for each grandchild

The TabView is creating a tabItem for each sub View in the child. Why is this happening? struct MyView : View { var body: some View { TabView { MyOtherView().tabItem { Text("item") } } } } struct MyOtherView : View { var body:…
Avba
  • 14,822
  • 20
  • 92
  • 192
1
vote
1 answer

Unwanted white space on Sheet

I have a basic tabview with 2 tabs. Tab 2 has a button to a modal sheet with a Page Style tabview imbedded in a Navigation Stack and added toolbar. When adding the Navigation Stack I get an unwanted white space at the bottom of the sheet view…
1
vote
1 answer

SwiftUI TabView repeats first entry

Xcode RC 14.1 The first tab is generated twice. The first one works, the second brings up a blank screen. This has been reported elsewhere on SO and people suggest removing Spacer()s but this made no difference. The code below has two variants, one…
Edward Hasted
  • 3,201
  • 8
  • 30
  • 48
1
vote
1 answer

SwiftUI TabView .tabItem image seems too high

Not sure if I am doing something wrong or if this is just how the TabView in SwiftUI appears now, but it seems to me that the images at the bottom seem much closer to the top border than in previous iOS versions (I am testing on iOS 16). Here is…
bryan-vh
  • 151
  • 1
  • 9
1
vote
1 answer

Requesting access with AVCaptureDevice causes a switch in selected tab in tab view

I am trying to add a QR scanner to my app that has a Tab View at the root. It sort of works except for one thing; When the dialog appears to ask the user for permission to use the camera, it also automatically switches the selected tab from the…
1
vote
0 answers

SwiftUI repeating TabView

From this article, I took this code: struct ContentView: View { var body: some View { TabView { Text("First") Text("Second") Text("Third") Text("Fourth") } …
Eyzuky
  • 1,843
  • 2
  • 22
  • 45
1
vote
1 answer

Disable Horizontal scrolling on using PageTabViewStyle for tabView swiftui

This is how my tabView looks like. I want the views to have a page feel thats why I'm using PageTabViewStyle, but I don't want the page to be scrollable on users swipe. How can I disable just the horizontal swipe/drag on the…
1
vote
0 answers

Render a TabView within a ScrollView

I'm trying recreate a view in SwiftUI that has the same behaviour as the Twitter profile page. The expected behaviour is a stretchy header, with tabbed views underneath. The content size of each tab will differ, however when changing tab the view…
Harry Blue
  • 4,202
  • 10
  • 39
  • 78