Im using a TabView and have noticed that 75% the time when switching tabs that there is at least 1 frame where before the expected view is drawn. That is quite annoying. Its not really noticeable if your views are super lightweight, otherwise you'll see what looks like a flash when switching tabs.
Here is a very basic example. I've set the background of the tabview to blue to illustrate the problem. When switching tabs you will see the blue background of the TabView before the expected view is drawn. Nothing more than a form with 5 basic rows.
import SwiftUI
struct ContentView: View {
@State private var selection = 0
var body: some View {
TabView(selection: $selection) {
Tab()
.tabItem {
Text("FIRST")
}
.tag(0)
Tab()
.tabItem {
Text("SECOND")
}
.tag(1)
}
.background(Color.blue)
}
}
struct Tab: View {
var body: some View {
List {
HStack {
Image(systemName: "gear")
Text("Advanced")
}
HStack {
Image(systemName: "gear")
Text("Advanced")
}
HStack {
Image(systemName: "gear")
Text("Advanced")
}
HStack {
Image(systemName: "gear")
Text("Advanced")
}
HStack {
Image(systemName: "gear")
Text("Advanced")
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}