Skip to content

Commit 20a38e3

Browse files
committed
wip
1 parent 39e371c commit 20a38e3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Sources/ComposableArchitecture/SwiftUI/Binding.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ public struct BindingViewStore<State> {
210210
fileID: StaticString = #fileID,
211211
line: UInt = #line
212212
) where Action.State == State {
213+
// TODO: Can we avoid this store scoping?
213214
self.store = store.scope(state: { $0 }, action: Action.binding)
214215
#if DEBUG
215216
self.bindableActionType = type(of: Action.self)
@@ -241,6 +242,7 @@ public struct BindingViewStore<State> {
241242
dynamicMember keyPath: WritableKeyPath<State, BindingState<Value>>
242243
) -> BindingViewState<Value> {
243244
BindingViewState(
245+
// OPTIMIZE: Can we derive bindings directly from `Store` and avoid the work of creating a `ViewStore`?
244246
binding: ViewStore(self.store, removeDuplicates: { _, _ in false }).binding(
245247
get: { $0[keyPath: keyPath].wrappedValue },
246248
send: { value in
@@ -282,6 +284,7 @@ extension WithViewStore where Content: View {
282284
observe: { (_: State) in
283285
toViewState(
284286
BindingViewStore(
287+
// TODO: Can we avoid this store scoping?
285288
store: store.scope(state: { $0 }, action: fromViewAction)
286289
)
287290
)

0 commit comments

Comments
 (0)