This is a skeleton Titanium Mobile Mobile module project.
Choose a unique module id for your module. This ID usually follows a namespace convention using DNS notation. For example, com.appcelerator.module.test. This ID can only be used once by all public modules in Titanium.
- Edit the
manifest
with the appropriate details about your module. - Edit the
LICENSE
to add your license details. - Place any assets (such as PNG files) that are required anywhere in the module folder.
- Edit the
timodule.xml
and configure desired settings. - Code and build.
You should provide at least minimal documentation for your module in documentation
folder using the Markdown syntax.
For more information on the Markdown syntax, refer to this documentation at:
http://daringfireball.net/projects/markdown/
The example
directory contains a skeleton application test harness that can be
used for testing and providing an example of usage to the users of your module.
Simply run ti build -p [ios|android] --build-only
which will compile and package your module.
You can use clang
to lint your code. A default linting style is included inside the module main folder.
Run clang-format -style=file -i SRC_FILE
in the module root to lint the SRC_FILE
. You can also patterns,
like clang-format -style=file -i Classes/*
To use your module locally inside an app you can copy the zip file into the app root folder and compile your app.
The file will automatically be extracted and copied into the correct modules/
folder.
If you want to use your module globally in all your apps you have to do the following:
Copy the distribution zip file into the ~/Library/Application Support/Titanium
folder
Copy the distribution zip file into the ~/.titanium
folder
Copy the distribution zip file into the C:\ProgramData\Titanium
folder
Register your module with your application by editing tiapp.xml
and adding your module.
Example:
When you run your project, the compiler will combine your module along with its dependencies and assets into the application.
To use your module in code, you will need to require it.
import MyModule from 'com.ebm.shareimage';
MyModule.foo();
var MyModule = require('com.ebm.shareimage');
MyModule.foo();
To test your module with the example, use:
ti build -p [ios|android]
This will execute the app.js in the example/ folder as a Titanium application.
Code strong!