Loading...
Loading...
Titanium Alloy MVC official framework reference. Use when working with, reviewing, analyzing, or examining Alloy models, views, controllers, Backbone.js data binding, TSS styling, widgets, Alloy CLI, sync adapters, migrations, or MVC compilation. Explains how Backbone.js models and collections work in Alloy.
npx skill4agent add maccesar/titanium-sdk-skills alloy-guidesapp/app/views/app/controllers/app/models/| Topic | Reference File |
|---|---|
| Core concepts, MVC, Backbone.js, conventions | CONCEPTS.md |
| Controllers, events, conditional code, arguments | CONTROLLERS.md |
| Models, collections, data binding, migrations | MODELS.md |
| XML markup, elements, attributes, events | VIEWS_XML.md |
| TSS styling, themes, platform-specific styles | VIEWS_STYLES.md |
| Dynamic styles, autostyle, runtime styling | VIEWS_DYNAMIC.md |
| Controllers-less views, patterns | VIEWS_WITHOUT_CONTROLLERS.md |
| Creating and using widgets | WIDGETS.md |
| CLI commands, code generation | CLI_TASKS.md |
| PurgeTSS integration (optional addon) | PURGETSS.md |
app/
├── alloy.js # Initializer file
├── alloy.jmk # Build configuration
├── config.json # Project configuration
├── assets/ # Images, fonts, files (→ Resources/)
├── controllers/ # Controller files (.js)
├── i18n/ # Localization strings (→ i18n/)
├── lib/ # CommonJS modules
├── migrations/ # DB migrations (<DATETIME>_<name>.js)
├── models/ # Model definitions (.js)
├── platform/ # Platform-specific resources (→ platform/)
├── specs/ # Test-only files (dev/test only)
├── styles/ # TSS files (.tss)
├── themes/ # Theme folders
├── views/ # XML markup files (.xml)
└── widgets/ # Widget componentsapp/controllers/index.jsfunction doClick(e) {
alert($.label.text);
}
$.index.open();app/views/index.xml<Alloy>
<Window class="container">
<Label id="label" onClick="doClick">Hello, World</Label>
</Window>
</Alloy>app/styles/index.tss".container": { backgroundColor: "white" }
"Label": { color: "#000" }$Ti.UI.iOS.*Ti.UI.Android.*// WRONG - Adds Ti.UI.iOS to Android project
"#mainWindow": {
statusBarStyle: Ti.UI.iOS.StatusBar.LIGHT_CONTENT // FAILS on Android!
}// CORRECT - Only adds to iOS
"#mainWindow[platform=ios]": {
statusBarStyle: Ti.UI.iOS.StatusBar.LIGHT_CONTENT
}
// CORRECT - Only adds to Android
"#mainWindow[platform=android]": {
actionBar: {
displayHomeAsUp: true
}
}statusBarStylemodalStylemodalTransitionStyleTi.UI.iOS.*actionBarTi.UI.Android.*[platform=ios][platform=android][formFactor=handheld][formFactor=tablet][if=Alloy.Globals.customVar]alloy generate model book sql title:string author:string<Collection src="book" />
<TableView dataCollection="book">
<TableViewRow title="{title}" />
</TableView>if (OS_IOS) {
// iOS-only code
}
if (OS_ANDROID) {
// Android-only code
}<Widget src="mywidget" id="foo" />| Task | Use This Skill |
|---|---|
| Modern architecture, services, patterns | |
| Alloy CLI, config files, debugging errors | |
| Utility-first styling with PurgeTSS (optional) | |
| Native features (location, push, media) | |