Closed sobabear closed 9 months ago
I wrote none of annotation for documentation of usage, unless this function would be suitable. if it is ok, i will do with your opnion
@sobabear
Thanks!
When passing a binding, it is correct to directly call the store's send()
as you suggested.
TextField(
"TextField",
text: Binding(
get: { store.state.searchText },
set: { store.send(.setSearchText($0)) }
)
)
The syntax sugar you suggested looks very nice. However, OneWay
avoids having UI-related dependencies to maintain a lightweight library. It seems better to create a separate module for UI Extension or to include it in your own project.
// In your own UI extension module or wrapping module
@_exported import OneWay
Related Issues π
I want to make sugar for just setter value on State for ViewStore when i use SwiftUI. Thus I suggest binder using keypath to setter for oneway
Description π
Lets suppose i use simple textfield app
I marked two line which both prints out. And when i types like "Hello OneWay",
Problem Line1
would be print " H", "He".... "Hello OneWay". However when i clicked, button which leads to Action.tapButtonForDebug prints out nothing but "" <- which is state.searchText.So on this problem, i mostly used to handle this problem like adding Binder like
You know whenever it is getting more and more properties on State, this binder makes code much larger, thats why i open this PR.
Expected result would be better than above code.
Additional Notes π
Checklist β