Huge finding @Weuler, thank you. @Eric-Yuan you can continue using \.dismiss, but you must create explicit captures for parameters to your destination, like this:
var param: Param
@Environment(\.dismiss) var dismiss
var body: some View {
Text("***")
.navigationDestination(for: Int.self) { [_param = self.param] intValue in
SomeSubview(param: _param)
}
}
This way, you don't capture self (the parent view, which has a non-equatable var) in SomeSubview, only self.param.
Post
Replies
Boosts
Views
Activity
@malc this is completely incorrect. You can have States for classes, even Apple recommends you to do it: https://developer.apple.com/documentation/SwiftUI/Migrating-from-the-observable-object-protocol-to-the-observable-macro
I marked my block: parameter @Sendable: await UIApplication.shared.beginBackgroundTask(withName: "someName") { @Sendable in ... } and the warning went away.