Titanium JIRA Archive
Alloy (ALOY)

[ALOY-525] Add support for new tag to group many blocks of XML code together easier

GitHub Issuen/a
TypeNew Feature
Affected Version/sn/a
Fix Version/sAlloy 2.0.0
ReporterJeff Haynie


Right now, if you have a set of XML code in your view that needs to be conditionally executed (either platform, formFactor, etc) you have to add the same logic on each tag in the group or be forced to wrap in a View tag. Wrapping in a view tag is as performant on certain platforms like Android where the view hierarchy depth is sensitive / limited. I'd like to introduce a new tag (IF) that will make this much easier and more capable of performing more dynamic structures. This should support both the existing conditionals: platform and formFactor. I'd like to also introduce a cond attribute whereby you can add additional JS logic or variable which which be used to evaluate the block.


  1. Tony Lukasavage 2013-04-12

    in commit: https://github.com/jhaynie/alloy/commit/62b70981ba11cf985a31b9133117f9ebc8d0e56b
  2. Tony Lukasavage 2014-01-20

    I'm going to reserve this for 2.0 and likely do so via some templating engine. Rather than reinvent the wheel, and the inevitable deluge of feature requests that will follow something like this, I'll likely lean on EJS or something similar, with the ability for developers to plug in their own templating engines before the Alloy compile step.

JSON Source