Skip to content

Instantly share code, notes, and snippets.

@nalexn
Created September 29, 2020 22:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nalexn/d315b7241a5ff8d7cf2b7f8782e75c9d to your computer and use it in GitHub Desktop.
Save nalexn/d315b7241a5ff8d7cf2b7f8782e75c9d to your computer and use it in GitHub Desktop.
extension ObservableObject {
func binder<Value>(_ keyPath: WritableKeyPath<Self, Value>) -> Binder<Value> {
Binder(self) { (object, value) in
var _object = object
_object[keyPath: keyPath] = value
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment