binding syntax for @ObservationState in TCA

193 Views Asked by At

The old binding syntax was, (for example), TextField("Name", text: viewStore.binding(get: \.text, send: { .updateText($0) })).

Since the ViewStore is no more, what's the new binding syntax?

1

There are 1 best solutions below

0
On

After digging into the Composable Architecture slack channel it appears that TextField("enter text here", text: $store.text.sending(\.updateText).animation() is the new syntax.

This relies on decorating the StoreOf<YourFeature> with an @State or @Bindable property wrapper.

animation() can be omitted, or provided with an optional parameter.