Created
May 10, 2020 07:46
-
-
Save lawreyios/ee5c05cea70d6ded9d7bdc827d9cbbfc to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Binding { | |
func onChange(_ handler: @escaping (Value) -> Void) -> Binding<Value> { | |
return Binding( | |
get: { self.wrappedValue }, | |
set: { selection in | |
self.wrappedValue = selection | |
handler(selection) | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment