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

Tabview not switching tabs properly

I have a tabview (page style) that I am using to create an automatic slideshow. Each slide is not assigned to the currentIndex for some odd reason. Neither does the timer work or manually switching tabs with the default dot controls given with…
Trevor
  • 580
  • 5
  • 16
0
votes
0 answers

SwiftUI - TabView automatically changes selection when size changes

I have a paging style TabView in a HStack with another view. I'm adding a selection binding to the TabView to programmatically control selection. When a tab is tapped the second view in the HStack disappears and the TabView resizes to fill the…
Alex Scanlan
  • 294
  • 2
  • 4
0
votes
1 answer

Endless re-render Swift UI Tabview with @EnvironmentObject

I have an @ObservableObject that I am passing down to a View, using: TabView() .environmentObject(stateManager) In that view, I'm using: @EnvironmentObject var stateManager: StateManager I'm trying to pass some data down one view deeper into a…
Kim
  • 856
  • 1
  • 11
  • 21
0
votes
1 answer

onChange(of: perform:) with enums not working in swiftui

Following code should print value when tab changes, But it is not printing as expected. The same code is working fine if I use the selected data type like Int or string instead of an enum. Do I need to confirm enum to anything for making this…
Sai Durga Mahesh
  • 205
  • 2
  • 13
0
votes
0 answers

SwiftUI TabView using selection index at ViewModel causing all the view to be blank

So this is a simplified version of my app which have I tried that reproduces the error, I have a TabView with 2 Tabs(HomeView &OrderView), if I placed the selection index using viewModel, everytime I go to OrderView and return back to HomeView, the…
Charas
  • 1,753
  • 4
  • 21
  • 53
0
votes
1 answer

How to prevent triggering the onChange closure of an inactive tab in a SwiftUI TabView

When setting up a SwiftUI TabView with two tabs, the onChange closures of inactive (non visible) tabs that listen to a @State or @Binding variable will always get triggered when the variable is changed from the active tab. I'd expect as long as the…
Marco Boerner
  • 1,243
  • 1
  • 11
  • 34
0
votes
0 answers

How to make SwiftUI TabView background transparent?

I've noticed that while most views in SwiftUI are transparent, TabView seems to add an opaque background to each view. So my question is how might I be able to remove the said opaque background to make the view transparent? I tried using this helper…
CodeSwift
  • 66
  • 1
  • 6
0
votes
0 answers

Warning logs when using NavigationView in TabView, but not working in iOS 14

I have very simple code, like so: struct ContentView: View { var body: some View { TabView { FirstView() } .tabViewStyle(.page) } } struct FirstView: View { var body: some View { …
George
  • 25,988
  • 10
  • 79
  • 133
0
votes
2 answers

How do I add a highlight to a TabItem label in SwiftUI

I have a TabView with custom icons - like this: PastView( settings ).tabItem { Image("past") Text("Past") }.tag(1) which works great - but just the text changing color is very subtle - it's not obvious which tab is…
Darren Oakey
  • 2,894
  • 3
  • 29
  • 55
0
votes
0 answers

TabView Going Back to First Page When Updated

I have a view within a tab view (it's the second tab on the list) that shows one of three conditional views dependent on a couple variables in the ViewModel for this view. The first view is a user selection (ChooseSeasonLength()), and when that gets…
Charlie Page
  • 541
  • 2
  • 17
0
votes
1 answer

How can I update the navigation title when I select a new tab?

I have a tabview with three SwiftUIViews (HomeView, FavoritesView and ContactsView) each of these views look like this Home View below. struct HomeView: View { var body: some View { VStack { Image(systemName: "house.fill") …
0
votes
1 answer

Embedding webview within a tabview in SwiftUI

I've been trying to create a TabView with PageIndexViewStyle where each page is a ScrollView that contains an image and a WebView. The example code here from @Asperi works great when I'm creating a page outside of the TabView, but when I move things…
sia
  • 256
  • 3
  • 14
0
votes
1 answer

tvOS SwiftUI TabView Dynamically Change Bar Color

I have a tvOS App with a TabView across the top. I want to use the background color of the TabView to indicate status. Initially it will be red and when something occurs in one of the views, I want to change the background color of the TabView to…
0
votes
1 answer

SwiftUI problem with not reloading Tab Item when using NavigationLink

I'm using Navigation View inside TabView and the problem is that if I an on Tab A and with NavigationView I open other Views, when changing from tab A to B and after a while I came back to tab A I dosen't reload tab A from beginning but it show the…
0
votes
0 answers

SwiftUI - Pages with embedded NavigationViews

I'm attempting to build a paging app, where each page has its own NavigationView. It sort of works, but I get a completely redundant "Back" button in the navigation bar. My code so far is - struct AllListsView: View { …
SomaMan
  • 4,127
  • 1
  • 34
  • 45
1 2 3
21
22