iOS 27 regression: Objects whose properties are bound to items displayed in a Menu are not correctly deallocated

A regression has been introduced with SwiftUI Menu in iOS 27 betas (still present in beta 6).

This regression prevents objects whose properties are bound to contained Menu items from being correctly deallocated.

In the example below, Player was immediately deallocated when the surrounding ModalView was dismissed on iOS 26 (or below):

import Observation
import SwiftUI

@Observable
final class Player {
    var playbackSpeed: Double = 1
}

struct ModalView: View {
    @State private var player = Player()

    var body: some View {
        Menu {
            Picker(selection: $player.playbackSpeed) {
                ForEach([0.5, 1, 1.5, 2], id: \.self) { speed in
                    Text("\(speed, specifier: "%g×")").tag(speed)
                }
            } label: {
                Text("Speed")
            }
            .pickerStyle(.inline)
        } label: {
            Text("Menu")
        }
    }
}

This is not the case anymore on iOS 27 beta. The Player instance is not deallocated anymore.

A dedicated feedback (FB24486991) has been opened.

iOS 27 regression: Objects whose properties are bound to items displayed in a Menu are not correctly deallocated
 
 
Q