TabView Bug: When switching tabs, there is a frame delay when before expected view is drawn

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()
    }
}

https://www.youtube.com/watch?v=7uDU2xyz-uc

Replies

Please file a bug report via https://feedbackassistant.apple.com/ with this sample project and video attached. The folks on the SwiftUI team would likely appreciate getting to spend time on this issue, but number of reports is a factor in prioritization, so the more people file bugs the more likely it's going to be resolved.

Just filed.


FB7386384


Thanks,
Jacob

Its quite frustrating that I've to get a single reply to my bug reported via the feedback assistant. I filled the report on Oct 16 with zero response. Does anyone know what I can do next?

same issue with complex views embedded in tabview, jittery bugs when scrolling between tabs
  • same issue here with complex views embedded in tabview

Add a Comment