Last month at the CODESTRONG conference, we announced the availability of the iOS version of the Module Development Guide reference module. We are happy to announce that the Android version of the reference module is now available. You can find the source code files for both at the titanium_modules Github repository. Under the moddevguide/mobile directory you’ll find the source to both the iOS and Android versions.
The Module Development Guide tutorials are an excellent starting point for developing your modules. However, it can be extremely helpful to have working code that demonstrates the principles and concepts in module development. That is the main purpose of this reference module. The module demonstrates core functionality that you will need in developing your module:
- Life Cycle Events – module loading, proxy loading, view proxy loading
- Properties – Types, getters, setters, property change notifications
- Methods – Method signatures and annotations
- Method Parameters – Type validation, type conversion, pass-by-value / reference
- Callbacks and Events – Event registration, asynchronous notifications, synchronous callbacks
- Miscellaneous – Accessing module and application assets, defining constants
Take a look at the module source code to understand how to implement each of these features. Feel free to cut-and-paste the code directly from the reference module source into your own module source code, removing any extra or unused parts of the code as necessary.
The sample application demonstrates the following aspects from the reference module:
- Proxy Loading – demonstrates the lifecycle events that occur when a proxy is loaded and unloaded
- View Proxy Loading – demonstrates the lifecycle events that occur when a view proxy is loaded and unloaded, along with the lifecycle events for the corresponding view object
- Properties – demonstrates how to access proxy properties and receive notifications when properties are updated
- Methods – demonstrates a number of ways to call proxy methods and pass various types of parameters
- Parameters – demonstrates how different types of parameters are received by the native module
- Assets – demonstrates how to locate and access module-specific and application resources from within the native module
The CODESTRONG presentation on module development and the introduction of the module development guide reference module can be viewed here.
The slides from the presentation can be viewed here.