3 ms·
It isn't too hard to setup two-way binding with KVO if you wanted to. You can have one way binding, you can have binding with a transformer function to go from
by alexashka 8y ago
It isn't too hard to setup two-way binding with KVO if you wanted to.
You can have one way binding, you can have binding with a transformer function to go from a number to a string etc.
Here's a playground where I did this a while back. You get type safety and nice syntax too.
https://gist.github.com/desugaring/828e9880f747678ac5912a070bd32dce https://gist.github.com/desugaring/828e9880f747678ac5912a070...
- dep_b 8y agoIt might as well be KVO under the hood, no problem. It's just that annotations can be really handy to indicate a ton of stuff that would otherwise be lines of code. I use it in other languages all of the time.
- jsgo 8y agoyeah, I'll agree here. Being able to slap an annotation on a method in C# is one of the major pluses. [Authorize] in ASP.NET MVC (Core as well I believe?), the various ones in Entity Framework, etc. Very useful.