TL;DR:
- Alloy views at compile time generate native primitives
- Native code would use these objects to build the UI bypassing JS land for better speed and performance including bypassing the bridge
- No more compiling markup to business logic that can lead to (IMHO at least) hard to define corner cases.
- This would make Alloy views titaniums cross platform version of iOS xib files
- Sample code can be found here ->
https://gist.github.com/mattapperson/0e9ef2947c1b1221d619
My full thoughts
IMHO Alloy views are inefficient, they might save on dev time, or draw on familiar concepts for those with a web background, but they don't add a lot in terms of performance and stability VS well written vanilla Ti. Not to mention if/when there are errors in the compiled JS from the views.
I suggest that titanium via a module or built in APIs support the processing of Alloy markup files.
Clearly, parsing XML at runtime is a bad idea, the Carbon Titanium module used JSON as parsing was faster, but this was still not ideal as parsing adds overhead.
I would thus further suggest that markup be compiled to native primitives such as in this example for iOS ->
https://gist.github.com/mattapperson/0e9ef2947c1b1221d619
I would argue that compile directly to iOS/Android/Hyperloop views is IMHO a bad idea in that you can get odd corner cases, and that dynamically built views based on data such as explained above is better and more stable.
*Note:* I did look into maybe compiling alloy vies to xib's and such, but xib's dont have all the features that alloy markup supports leading to business logic generation along with native view markup... this felt nasty/ugly so moved on from that idea... maybe someone else is smarter then me and can make that work in a less ugly way
The original reporter is me@mattapperson.com