4 ms·
Yessssss for the allCases property for enums!!! Enums are really the best feature of Swift. I enum all the things everywhere. This is kind of the finishing tou
by dep_b 8y ago
Yessssss for the allCases property for enums!!!
Enums are really the best feature of Swift. I enum all the things everywhere. This is kind of the finishing touch to it.
Binary stability would be nice. I do care about the download sizes of my apps. What's really missing from the language is a way to add custom tags like @discardableResult @objc to define some kind of property. It's such a kludge to set up things like ViewModels while I really would like to have something like:
@twoWayBinding[username]
lazy var username: UILabel = { /* etc */ }()
- alexashka 8y agoIt 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.