Hello, I'm a new programmer here, so this may be an error on my part, however I have tried my best to research the issue and believe I may have discover a bug. I have a set of tabItems inside of a TabView using a variable to track the selected tab called selectedIndex. I have added in a text view to watch the selected tab. This works correctly in the canvas and in a simulator, however whenever I build this on an iOS Device or for my Mac the selectedIndex does not change when selecting tabs like it does in the canvas and simulator. Instead it just stays at the default 0. Any assistance would be great. :-)
import SwiftUI
struct ContentView: View {
@State private var selectedIndex = 0
var body: some View {
Text("\(selectedIndex)")
TabView(selection: $selectedIndex) {
FilteredApplicantListView()
.tabItem { Label("Applicant Processor", systemImage: "person.3.sequence.fill") }
.tag(0)
QuickFinancials()
.tabItem { Label("Quick Financials", systemImage: "dollarsign.gauge.chart.leftthird.topthird.rightthird") }
.tag(1)
MoveInView()
.tabItem { Label("Move Ins", systemImage: "figure.walk.arrival") }
.tag(2)
MoveOutView()
.tabItem { Label("Move Outs", systemImage: "figure.walk.departure") }
.tag(3)
}
}
}