6 ms·
Again, because this makes declarative UI cleaner to write, or if you prefer to put it this way: reduces clutter. I could create button templates then make slig
by Razengan 7y ago
Again, because this makes declarative UI cleaner to write, or if you prefer to put it this way: reduces clutter.
I could create button templates then make slightly different copies of those templates without having to subclass Button or attaching .copy()
SwiftUI is all about succinctness.
- rhysmorgan 7y agoWhy is it all about succinctness? Swift has never been about succinctness - it’s always been about clarity, without over-verbosity. Sometimes, it just takes a decent number of characters to describe something. That’s not necessarily a flaw, especially if it makes something easier to read. Seeing .copy() makes it much clearer to understand that what I’m receiving is a copy of something. If you want a Button template, either extend Button with a method taking the parameters you want, or write a curried free function or something. callAsFunction adds absolutely nothing to the language, bar confusion at the call site.
- zionic 7y agoPlaying code golf with the language syntax isn't the point, clarity and expressiveness is.