Hacker News new | ask | show | jobs
by alexashka 2936 days 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/828e9880f747678ac5912a070...

1 comments

It 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.
yeah, 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.