Keep Going with Apps failure to dismiss

In the "Keep Going with Apps" Playground under the "Add and delete creatures" section, you are guided through how to "Dismiss the editor when you tap Add". Just one problem: it doesn't work. I'm on Monterey 12.6 (21G115) with Playgrounds 4.1 (1676.15). This is version 1.0.0 (December 15, 2021) Swift 5.5 edition of the playground. (It doesn't work with the previous version of MacOS I had installed, either.)

The simplified version of the code:

import SwiftUI
import Guide

struct CreatureEditor: View {
    @EnvironmentObject var zoo: CreatureZoo
    @Environment(\.dismiss) private var dismiss    
    @State var newCreature = Creature(name: "", emoji: "")    

    var body: some View {
        SPCAssessableGroup(view: self) {
            VStack(alignment: .leading) {
                Form {
                    // omitted
                }
            }
            .toolbar {
                ToolbarItem {
                    Button("Add") {
                        zoo.creatures.append(newCreature)
                        dismiss()
                    }
                }
            }
        }
    }
}

It's easy enough to confirm the closure is being called. The view is contained inside the ContentView, which in turn is contained inside a NavigationView in MyApp.

The documentation of the dismiss property notes that "The dismiss action has no effect on a view that isn’t currently presented." So I pulled in @Environment(\.isPresented) private var isPresented and confirmed it's set to true.

Any thoughts? Until this point, this playground has been an excellent way to learn SwiftUI.

Update: The now-deprecated presentationMode.wrappedValue.dismiss() also fails to dismiss, so it's quite possible something is structurally wrong with the playground app.

So, interestingly, when previewing the ContentView file (which doesn't have a _Previews struct at all! unclear what Playgrounds is using as the default) and the width of the window causes it to render like an iPhone, everything works as expected. However, when widening the preview to the point that it renders like an iPad, it displays the same behavior as the compiled app. It appears dismiss() is not enough to clear out the navigated-to-view and return to the previous view. (It also appears there is no way to force the app to behave like an iPhone.)

It seems like I'll worry about dismiss() once I actually move on to real, non-Playground apps.,

Keep Going with Apps failure to dismiss
 
 
Q