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

Change Tabbar Icon Image SwiftUI

I want to change tabItem icon image when tapped on one of the tabItem in this code. How can it be done? var body: some View { ZStack { TabView(selection:$selection) { OffersView() .tabItem ({ …
Mert Köksal
  • 817
  • 1
  • 7
  • 26
1
vote
2 answers

TabView unable to position image correctly

I'm building the step-by-step view (Paged Scrolling View with PageTabViewStyle) I tried to put the images and the text in a ZStack but that did not solve the problem. I added a Spacer() with padding, also failed. What confuses me, is that whenever I…
Lewis
  • 129
  • 1
  • 8
1
vote
1 answer

SwiftUI PageView update outside view

I have a PageStyle TabView, and want to update a Text that is outside of it. I've used onAppear to get the page change event, and looks good at first if I scroll forward, but once I go backwards a few onAppear are missed. Is this the correct way of…
lorenzo
  • 1,487
  • 1
  • 17
  • 25
1
vote
0 answers

SwiftUI - After Moving App to Background Then Restoring to Foreground, TabView Loses Color

I have a SwiftUI 5.3 Multiplatform app in Xcode 12.2 on MacOS 11.01 running on iOS 14.2 that uses a custom color asset for light/dark modes. When starting up the app, it functions perfectly fine alternating between light and dark modes. All the…
dmiannay
  • 115
  • 1
  • 2
  • 10
1
vote
0 answers

More TabView in SwiftUI

In SwiftUI I have a TabView that includes more than 6 tabs. When I attempt to navigate to the More Tab, the More Tab will not work. How would I make the more Tab work? I can now navigate using all the other tabs but I can not navigate using the…
CableGuy
  • 47
  • 1
  • 6
1
vote
1 answer

SwiftUI - TabView Light Mode UIColor Appears in Preview, not in Sim or Device

I am using Swift 5.3 on MacOS 11.01 and created a new "Multiplatform" app for iOS 14.2. I created custom color assets for light/dark modes but am having trouble getting the light mode background color to show on my TabView. The TabView dark mode…
dmiannay
  • 115
  • 1
  • 2
  • 10
1
vote
1 answer

Clear View Data When Tab is Changed SwiftUI

I am showing daily step information in one of the tabs. Unfortunately, when I select the steps tab again it adds one more of the same data below the previous one. I have tried to solve it via toggle a boolean. But it did not help either. import…
Mert Köksal
  • 817
  • 1
  • 7
  • 26
1
vote
1 answer

SwiftUI: List rows get highlighted when interacting with other views if inside a TabView

If a List is placed along with other views within a VStack which defines one page within a TabView with PageTabViewStyle, interacting (tap, long pressing) with the other views causes all (visible) rows of the List to get highlighted. The following…
mmklug
  • 2,252
  • 2
  • 16
  • 31
1
vote
3 answers

SwiftUI tab view display sheet

I'm new to SwiftUI and I tried to build a tab bar that contained a tab that will return a modal(sheet) but not view. After I tried I found sometimes it will work but sometime are not. I want to make the previous tabbed item as the selected tab after…
Oxford212
  • 89
  • 1
  • 8
1
vote
2 answers

SwiftUI TabView not updating View

My problem is that TabView is not updating. I want to log-in and then re-render another view (Profile Screen) instead of (Login Screen) in the same TabItem. The TabView goes to ProfileScreen only after i kill the app and reopen it. Here's the…
1
vote
0 answers

SwiftUI TabView not responding

:-) Here comes a probably silly problem with a bit of a preamble sorry! Long story short - I've been developing an app pulling my hair out due to a bug with the TabView in SwiftUI. I was overlaying the tabs with a ZLayer to add a funky big button in…
0
votes
0 answers

How to force focus on Digital Crown in SwiftUI TabView on watchOS

I have a tricky use case with vertical TabView in SwiftUI on watchOS. I display a Map in a Tabview with a button to toggle interaction with the map using Digital Crown to zoom/pan. If I have no interaction with the map, I can move from one tab to…
0
votes
0 answers

SwiftUI layout issue for embedded TabView in NavigationView on watchOS

I have noticed a very strange issue when using two embedded TabView in a navigation view. My code sample show a TabView (page mode) imbedded in a NavigationView. One of the tabs (tag 2) is also a TabView (verticalPage mode). When I first display…
0
votes
1 answer

List with TextFields moves background when TextField in focus SwiftUI

The background of List is moving when keyboard appears. I have next implementation: import SwiftUI struct ListScroll: View { // Test data let data = [ User(id: UUID(), name: "Yevhen", age: 35), User(id: UUID(), name:…
0
votes
0 answers

How to Hide CustomTabBar when i Navigate to OtherViews from its ChildViews in swiftui

iam new to swiftui and i got a requirement to create CustomTabBar and hide that CustomTabBar in other contentViews except its child views and I have created CustomTabBar and i want to hide this custom tab bar when i navigate to other views from…
Viswa
  • 1
  • 3