top | item 21954204

(no title)

amimetic | 6 years ago

This is exactly the kind of thing that is unnecessarily hard in non-React-like UI frameworks. XML definitely does not do this well!

In React Native or Flutter I can just declaratively go from an array to rows of UI. It will be a few lines of code and will be incredibly clear (and easy to change).

In Android or iOS I can either do something procedural (which is messy, hard to reason about etc) or do something horrifyingly boilerplate-y (as you suggest), spreading things across multiple files and greatly increasing cognitive load.

I've worked with native Android, native iOS, React Native and (a tiny bit) with Flutter. I really wouldn't use vanilla native Android or iOS (even for a single platform app) unless there were some particular requirements around perf or whatever; so much more tedious, slower and (this one is subtle and will be missed by simple comparisons) so, so much harder to go back and make changes or additions to.

SwiftUI and Jetpack compose look promising for the future. But neither are ready for mainstream (enterprise?) use today.

discuss

order

crowbahr|6 years ago

I mean if you want 3 identical rows to just statically be at the bottom of a view you can always define the row in XML then put it in a vertical LinearLayout at the bottom using the <include> tag. You maintain modularity without cumbersome code to deal with.

This has the added benefit of being able to see the views without having to compile your code.

amimetic|6 years ago

Please try out one of Flutter or React Native. I think you’ll be surprised how much nicer they are for anything like this. The code is certainly not cumbersome when compared to the equivalent XML.

Also, in Flutter and React Native you don’t (typically) have to wait for your code to compile as they do hot reload.