Replies: 1 comment
-
Hi @arasan01, if I am understanding correctly it sounds like you want to be able to have logic inside your If that's the case then I think you can somewhat simplify your code. You can have the feature model just hold onto some boolean state: class FeatureModel: ObservableObject {
var isDismissed = false
// ...
} And then you can listen for that state to change in the view and dismiss: struct FeatureView: View {
@ObservedObject var model: FeatureModel
@Environment(\.dismiss) var dismiss
var body: some View {
List {
// ...
}
.onChange(of: self.model.isDismissed) {
if $0 { self.dismiss() }
}
}
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
swift-navigation has already become one of the indispensable libraries in my app development.
There is an issue I encountered during development: there seemed to be a lack of a way to manipulate methods that have been propagated only by dismiss or View. For example, this is the case.
So I have taken this action. This seems to work well for our project.
Implementations that achieve this
Does this match the swift-navigation philosophy? Also, I think this is one of the most useful use cases, but does it match the point-free style? We welcome your opinions.
Beta Was this translation helpful? Give feedback.
All reactions