Created
October 29, 2021 18:45
-
-
Save mbrandonw/c99ec1c5df864f5e4a4d91604ebff68c 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 didSet(_ perform: @escaping (Value) -> Void) -> Self { | |
| .init( | |
| get: { self.wrappedValue }, | |
| set: { newValue, transaction in | |
| self.transaction(transaction).wrappedValue = newValue | |
| perform(newValue) | |
| } | |
| ) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment