SwiftUI ForEach will always crash a Playground on Mac

Using ForEach always crashes a Playground on MacOS:

Code Block swift
import PlaygroundSupport
import SwiftUI
struct ContentView: View {
  var body: some View {
    ForEach(["Any", "Data"], id: \.hashValue) { str in
      Text(str)
    }
  }
}
PlaygroundPage.current.setLiveView(ContentView())


Code Block
error: Execution was interrupted, reason: signal SIGABRT.

Replies

This seems to be an issue with results bar on the right, because moving the view to a separate file in Sources (press Command 0) works fine.
Hi rick21,

Can you file a bug via Feedback Assistant, and post the Feedback number here?

Meanwhile, this should work as expected in Swift Playgrounds on Mac.

—jasonag.
@rick21 Can you explain what you mean by "moving the view to a separate file in Sources"? This bug is currently giving me massive trouble, and Command+0 does nothing.

@jasonag Swift Playgrounds on Mac is where this bug occurs...
Disabling "Enable Results" fixed this for me :)
I've filed a bug through Feedback Assistant for this issue (with an attached minimal reproducible example), the feedback ID is FB9067573
Click on the speedometer button in the bottom left of the canvas and turn off Enable Results.

This seems to be an issue with using SwiftUI in Playgrounds, so when you have errors that have nothing to do with your code make sure that this setting is turned off.