27.6 Adding Tab Item Tags
To control the currently selected tab in code, a tag needs to be added to each tab item and a state property declared to store the current selection as follows:
struct ContentView: View {
@State private var selection = 1
var body: some View {
TabView() {
Text("First Content View")
.tabItem {
Image(systemName: "1.circle")
Text("Screen One")
}.tag...