Post

Replies

Boosts

Views

Activity

SwiftUI reload TabView Tabs not properly
Hi, I've trying to implement a Bottom Bar Navigation with SwiftUI where each tab fetches some related data. The problems are mainly two: Each time I select a tab, the parent who contain the TabView get reloaded If I chose the third tab (for instance), the first and second tab gets reloaded ( and fetch remote data again…) I don't get if it's a TabView bugs or I am doing something wrong… struct HomeView: View {     @EnvironmentObject var authenticatedUser : AuthenticatedUser     @State private var selectedIndex = 0         var body: some View {         TabView(selection: self.$selectedIndex) {                 MyProfileView()                     .tabItem {	Image(systemName: "person")	} .tag(0)                 DashboardView()                     .font(.title)                     .tabItem { Image("archivebox") }                     .tag(1)                 TopTrendsView()                     .font(.title)                     .tabItem { Image("square.grid.3x3") }                     .tag(2)                 MyAccountView()                     .font(.title)                     .tabItem {	Image("gearshape")	}                   .tag(3)             }.tabViewStyle(DefaultTabViewStyle())         } } I've tried with both XCode 12 beta 4 and XCode 11
2
0
5.1k
Aug ’20