Created
September 9, 2019 21:57
-
-
Save mbrandonw/73548617fc1ec060af5f3af8575722a2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Store { | |
public func send<LocalValue>( | |
_ action: @escaping (LocalValue) -> Action, | |
binding keyPath: KeyPath<Value, LocalValue> | |
) -> Binding<LocalValue> { | |
Binding( | |
get: { self.value[keyPath: keyPath] }, | |
set: { self.send(action($0)) } | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment