Custom binding syntax

Hello, total Swift beginner here...

Can someone kindly explain to me what the role of $0 is in the setter for binding for the following code?

Any help would be greatly appreciated.

It represents the new value being passed to the setter

1 Like

Thanks for the reply. Would this be an example of shorthand closure syntax?

Yes, and it's also known as an anonymous closure argument (per Closures — The Swift Programming Language (Swift 5.5)).

1 Like

Amazing, I will check that out. Thanks so much.

Terms of Service

Privacy Policy

Cookie Policy