Until now, I used to hide certain views (e.g.: Sheets) with the presentationMode dismiss function. But in iOS 16, more specifically SwiftUI 4, Xcode tells me "Publishing changes from within view updates is not allowed, this will cause undefined behavior" when pressing a Button with the dismiss function. My Question is if this is generally not the right approach, if it is a Swift bug or did SwiftUI 4 change something, so it is the wrong approach now. And if it is not the first, a solution for the problem.
Thanks in advance