SwiftUI DisclosureGroup breaks on macOS

I have a default SwiftUI project for iOS. I want to run that on Apple Silicon macOS.

Here is my ContentView

import SwiftUI

struct ContentView: View {
    @State private var isOpen1 = true
    @State private var isOpen2 = false
    @State private var toggle1 = false
    @State private var toggle2 = false
    
    var body: some View {
        DisclosureGroup("Test 1", isExpanded: $isOpen1) {
            Toggle("Toggle 1", isOn: $toggle1)
        }.padding()
        
        DisclosureGroup("Test 2", isExpanded: $isOpen2) {
            Toggle("Toggle 2", isOn: $toggle2)
        }.padding()
    }
}

Now I run it selecting My Mac (Designed for iPad) and do the following

  1. Click Test 1 group to close it
  2. Click Test 2 group to open it
  3. Click Toggle 2 to change its state

Problem is that step 3 does not work. It works on iPhone and iPad but not on Mac.

What I see from other experiments this seems to somehow connect to the animation. If I programmatically open and close DisclosureGroups without animation, this seems to work but with animation stops working. Random clicking may fix things until it breaks again.

Affects at least Toggle and Slider.

Any ideas?

Last tested XCode 13 beta 5 and macOS 12 Beta 6 and problem persists.

SwiftUI DisclosureGroup breaks on macOS
 
 
Q