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

TabView with custom views using ForEach in SwiftUI

I previously asked a question about how to link an array of TabButtons to .tag() here: .tag() in TabView in SwiftUI challenge, but now I want to customize each TabView to have different information and not just the one line of text that reads from…
Laren
  • 37
  • 1
  • 8
1
vote
1 answer

SwiftUI TabView how can I load more data on 2nd tab click

I am working with TabView and would like to add more data when a user clicks for the 2nd time on the same tab item . I have been looking at other examples such as this SwiftUI TabView On Click Action however I have not been able to get it to work .…
user1591668
  • 2,591
  • 5
  • 41
  • 84
1
vote
0 answers

How to hide More button in swiftui tabview iam using more than 7 tabs

I added more than 7 view controllers to the tabview, it shows more at the end, I want to disable, or hide it?
Tony Stark
  • 21
  • 3
1
vote
0 answers

view automatically pop to previous view in swift ui due to view model is observed from tabview to inside multiple view?

I am facing an issue while pushing 1 view to another view. Let me explain the hierarchy. ContentView -> 2 tabs, TabAView and TabBView Inside TabBView. There is 1 view used ConnectView: Where is a Button to connect. After tapping on the button of…
1
vote
2 answers

SwiftUI TabView with PageTabViewStyle in Landscape on device with safeArea adding odd leading edge inset

I have a TabView with PageTabViewStyle and when my device is in landscape orientation, there is an odd inset on the leading edge. This is not there on devices without a safeArea and it is not there on any edge in portrait. struct ContentView: View…
alionthego
  • 8,508
  • 9
  • 52
  • 125
1
vote
3 answers

SwiftUI: How to update image to filled / outlined in TabView

I'm trying to use filled image when it is selected and outlined image when it is deselected. I tried to render the images but still filled So I thought this would work, but it doesn't: struct ListTabView: View { @State private var selectedTab =…
Hamad Fuad
  • 266
  • 3
  • 12
1
vote
1 answer

SwiftUI Custom Tab Bar icons not changing the tab. Area is above it

I am currently having trouble with my Custom Tab Bar there is a gray area above it (Tab View) that controls each tab but I need that to go under my custom tab bar but functionality of the TabView still be in effect and be used with the icons. You…
KeyesCode
  • 115
  • 1
  • 13
1
vote
2 answers

Use VNDocumentCameraViewController as a UIViewControllerRepresentable in a TabView

I have VNDocumentCameraViewController as a UIViewControllerRepresentable in a view called ScanView embedded in a TabView as the 2nd screen. On dismissing the VNDocumentCameraViewController (either on cancelling or on saving of the scan), I want the…
1
vote
2 answers

SwiftUI TabView PageTabViewStyle crashes without showing any error

I am trying to create an Image carousel using tabview and loading pictures from firebase. Without showing any error message or code tabview crashing. Please shed some light on what's going wrong here. struct HomeView : View{ var body : View{ …
Mac_Play
  • 302
  • 4
  • 21
1
vote
2 answers

SWIFTUI 2, SWIFTUI 3 - MACOS: Why TextField's onCommit closure is always trigger every time I switch to another tab

My code: I use onCommit closure to be able to perform an action by pressing the Enter key when the TextField is being focused. import SwiftUI struct ContentView: View { @State private var text = "" var body: some View { TabView { …
Thai D. V.
  • 483
  • 1
  • 5
  • 11
1
vote
1 answer

SwiftUI TabView gives an error message during add/delete the element of CoreData

I am currently trying to use TabView for carousel view(PageTabViewStyle) with CoreData. The error doesn't occur, when I add a new page in order like this age.name: 3, page.name: 4, page.name: 5 But the error occurs, if I put a number in the…
Taeeun Kim
  • 964
  • 1
  • 8
  • 20
1
vote
0 answers

Dynamically remove tabs from TabView, PageTabViewStyle

Removing an item from the end of the pages array results in an error when swiping through the pages. Is there a way to dynamically remove views from TabView as needed? import SwiftUI struct ContentView: View { @State var pages = ["1", "2", "3",…
Hamer
  • 1,354
  • 1
  • 21
  • 34
1
vote
0 answers

In SwiftUI, entering a text field in TabView calls all its views' onAppear()

I have a TabView like so: TabView { View1().tabItem{Text("1")} View2().tabItem{Text("2")} View3().tabItem{Text("3")} } Whenever I enter a TextField in any of the views, onAppear() gets called on all of the views causing bugs and other…
Fred
  • 381
  • 5
  • 17
1
vote
1 answer

How to use different tab items for selected/unselected?

How can I make a different tab item for selected and unselected tabs? For example, I would like to use a different image and make the selected text bold. This is what I have: struct ContentView: View { @SceneStorage("selectedTab") private var…
TruMan1
  • 33,665
  • 59
  • 184
  • 335
1
vote
0 answers

SwiftUI Dynamic Tab View

I trying to display a dynamic page tab view but it keep crash without the error code. The crashed happened when the number of tab view decrease. I cant find what's wrong with my code. So I tested in the sample project but it still the same. In the…
Aatrox11
  • 65
  • 4