-
-
Save jasdev/31c50e00016aa03866adafd501708bde to your computer and use it in GitHub Desktop.
Deriving a setter from a key path.
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
func setterFromKeyPath<Value, Subject>( | |
_ keyPath: WritableKeyPath<Value, Subject> | |
) -> (inout Value, Subject) -> Void { | |
{ value, subject in value[keyPath: keyPath] = subject } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment