This documentation relates to previous versions of Titanium Studio.

To see the latest documentation, visit docs.appcelerator.com.

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

Alloy is a new application framework by Appcelerator for Titanium. It provides a nice MVC framework for developers that are building Titanium apps.

See details at http://www.github.com/appcelerator/alloy

Installing Alloy

  1. Download or update to version 2.1.2 or greater of Titanium Studio from http://preview.appcelerator.com
    1. Windows: http://preview.appcelerator.com/appcelerator/studio/standalone/install/beta/Titanium_Studio.exe
    2. Mac: http://preview.appcelerator.com/appcelerator/studio/standalone/install/beta/Titanium_Studio.dmg
  2. Install the Alloy plugin from the "beta" stream of http://preview.appcelerator.com
    1. http://preview.appcelerator.com/appcelerator/studio/alloy/update/beta/

Creating an Alloy Project

  1. Select File > New > Titanium Mobile Project
  2. Select the "Alloy" entry in the first screen.
  3. Continue the rest of the way through the wizard

Creating a new Controller

Controllers and views describe the logic and presentation of your application's information. Creating a controller creates control, style and view files for you to edit.

  1. Right-click on a your project in App or Project Explorer
  2. Select New > Alloy Controller
  3. Enter the name of the controller. It will warn you if a duplicate exists.
  4. Click OK
  5. /app/controllers/name.js, /app/styles/name.tss, and /app/styles/name.xml are created.

Creating a new Model

Models describe data about a specific item.

  1. Right-click on a your project in App or Project Explorer
  2. Select New > Alloy Model
  3. Enter the name of the model. It will warn you if a duplicate exists.
  4. Select the type of storage.
    1. For SQL, select enter the names of the items in the model and the corresponding type.
  5. Click OK
  6. /app/models/modelName.js and /app/models/modelName.json are created. It will also create a migration under /app/migrations/.

Creating a new Migration

Migrations allow your database to be migrated from one version to another.

  1. Right-click on a your project in App or Project Explorer.
  2. Select New > Alloy Model
  3. Enter the name of the migration. It will warn you if a duplicate exists.
  4. Click OK
  5. /app/migration/migrationName.js is created.

Creating a new Widget

Widgets are encapsulated bits of functionality that can be reused across your application.

  1. Right-click on a your project in App or Project Explorer.
  2. Select New > Alloy Widget
  3. Enter the name of the widget. It will warn you if a duplicate exists.
  4. Click OK
  5. /app/widgets/WidgetName is created as a folder structure with widget information.

Running your application

  1. In Project Explorer, click the Run button
  2. The application launches.

Debugging

Debugging is in-the-works, so you'll need to do a few workarounds at the moment.

  1. Show the Resources folder
    1. Project/App Explorer View Menu (small little triangle)
    2. Customize View...
    3. Uncheck Titanium Resource Folders
  2. Navigate to Resources/alloy/controllers
  3. Inside you’ll find the controller object
  4. Set breakpoints and eval variables
  5. It's obfuscated, so not for the faint of heart

Updating Alloy

If alloy is out of date, you can update it on the command line. Use:

Code Block
sudo npm update alloy -g