This problem still appears to be a bug in Xcode 13.0 using SwiftUI. The dismiss() works fine in my case until I select a toggle button on that view. Then the dimiss() stops working.
Post
Replies
Boosts
Views
Activity
Image, color and file literals were removed from Xcode 13's code completion. So instead of typing "image lit", type the code: #imageLiteral(resourceName: "")
In case others see this, ForEach does everything a For loop does except that ForEach is designed to be used with SwiftUI. ForEach returns the needed view.
This worked for me as well. Thanks.
Unfortunately that is a dead link now.