SwiftUI: Crash when using hiding a ProgressView in a Picker label

Number:rdar://FB8755413 Date Originated:2020-09-29
Status:Open Resolved:
Product:SwiftUI Framework Product Version:Xcode 12.0 (12A7209) targeting iOS 14.0.
Classification:Application Crash Reproducible:Easily
I am trying to put a ProgressView inside a Picker label. When I tap the Hide Spinner button, this (intermittently) crashes with EXC_BAD_ACCESS (code=EXC_I386_GPFLT).

Build and run this code. Xcode 12.0 (12A7209) targeting iOS 14.0.

struct ContentView: View {
    @State private var selectedCity = ""
    @State private var showSpinner = true
    let cities = [
    var body: some View {
        NavigationView {
            VStack(spacing: 0) {
                Form {
                    Picker(selection: $selectedCity, label:
                            HStack {
                                Text("Your City")
                                if showSpinner {
                                        .padding(.horizontal, 2)
                    ) {
                        ForEach(cities, id: \.self) { city in
                    Button("Hide Spinner", action: { showSpinner = false })
            .navigationBarTitle("ProgressView Crash", displayMode: .inline)

I get the same behaviour when wrapping a UIActivityIndicatorView in a UIViewRepresentable.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!