0.55.1 to latest, challenge with bindings in view #2966
-
So in my legacy TCA app currently we use Bool binding type in the
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
@imfractured That's a big upgrade! Did you go one step at a time and follow the migration guides? As for how to create an ad hoc binding, the modern equivalent is documented here: https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/bindings/#Ad-hoc-bindings In your case you have a lot of computation happening, so the best you can do to approximate this is with a custom property on your store: extension StoreOf<MyFeatureName> {
var isBaggingPresented: Bool {
get { status == .bagging }
set {
if !newValue {
send(.hideBaggingView)
}
}
}
}
// ...
.fullScreenCover(isPresented: $store.isBaggingPresented) { /* ... */ } |
Beta Was this translation helpful? Give feedback.
-
Hi @imfractured, you should be able add an $store.status.isBagging.sending(\.setBagging) Also I will mention that we highly recommend you upgrade your app one version at a time (i.e. first to 1.0, then 1.1, then 1.2, etc.). That makes it far easier to find problems without needing to understand all versions of TCA at once. |
Beta Was this translation helpful? Give feedback.
@imfractured That's a big upgrade! Did you go one step at a time and follow the migration guides?
As for how to create an ad hoc binding, the modern equivalent is documented here: https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/bindings/#Ad-hoc-bindings
In your case you have a lot of computation happening, so the best you can do to approximate this is with a custom property on your store: