GithubHelp home page GithubHelp logo

mdpauley / tistarter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from applification/tistarter

1.0 3.0 0.0 8.05 MB

Titanium Appcelerator Starter

License: Other

JavaScript 98.40% Python 1.60%

tistarter's Introduction

Build Status

Ti Starter (Tabbed UI)

A starter project for Appcelerator Titanium that showcases best practice techniques and can be used to kick-start your Ti App

Getting Started

This project makes heavy use of NPM packages. Once downloaded you will need to run the following from your command line to install all dependencies:

npm install

Splash Screens

If you want your splash screens to look right across all the variety of mobile devices then you need to use:

  • iOS Storyboards
  • Android .9patch

This start app uses both and integrates with TiCons CLI so you can generate them from a single image.

Bonus - TiCons also handles the generation of App Icons and Assets for you.

App Design / Architecture

To deliver the best user experience this app makes use of the best native UI elements for each platform.

NB: I've seen and had to implement many based app architectures. Don't do this! It's really bad for performance and negates the whole point of Titanium IMHO. Use the native UI elements and a based architecture to ensure your app performance and user experience is not crappy.

This is a tabbed UI and it's important to note that iOS and Android deal with tabs slightly differently.

Alloy Theming

A number of global styles are configured in: /app/config.json These are used within the TSS files to make it easy to re-skin the app with a few style color changes.

Android Custom Theme

To get the best native styling on Android you need to use a custom theme. This is set up in: /app/platform/android/res/values/custom_theme.xml

Android Window Animations

The default Window animations built into Android with Titanium are a little uninspiring. Fortunately you can add and use custom window animations, this starter app bundles a few extras in: /app/platform/android/res/anim/

The app is currently pre-configured to use Twitter style window animations with scaling and sliding.

ListViews

TableViews can be slow (especially on Android) this app uses ListViews throughout as necessary.

Alloy Models / Binding / Templates

Alloy Models & Data Binding make it very easy with minimal code to bind data. There are other ways to do this but I prefer the simple and maintainable approach!

Custom Fonts

To illustrate using Custom Fonts the app is pre-configured with SF Compact. This works on both iOS and Android by renaming the font.

FontAwesome

FontAwesome is integrated so you can use font based icons throughout the app to reduce the number of images required in your app, reducing app size and improving speed.

NB: There are some places you can't use Font Icons, e.g Tab Icons

Language Strings

It's always a good idea to set up the app for multiple languages from the outset. The language strings are held at: /app/i18n/

Unit Tests

There is no ideal supported option in Titanium for Unit Testing but I still think it's useful to set up and run a few tests.

This starter project is configured with two options:

Ti-Mocha

Probably the most widely supported option, Ti-Mocha is handy but sadly has to be run in parallel with a simulator or device so it's not an ideal solution for me.

That said if you want it check the following files:

  • app/alloy.jmk
  • app/alloy.js
  • app/config.json
  • app/specs/

By default the tests are NOT running. If you want them to run, change run_unit_tests to true in config.json

NB: When running tests the runner does not know how to handle Ti.App.Android.R.anim. You will see there is some hacky bypass which checks the run_unit_tests var and turns on / off the custom Android Window animations appropriately

Ti-Slag

A headless option is Ti-Slag but it's unofficial and it's limited in what you can actually test. That said it's my preference as it can be integrated with CI easier.

Ti-Slag has been set up to run with AVA and is pre-configured with a number of NPM Script options:

npm run test:ios:watch
npm run test:android:watch

Code Coverage

I had wanted to make use of the Istanbul Code Coverage support of Ti-Slag, however, as this is an Alloy project I've yet to find a way to do so.

ESLint

To ensure a certain level of code quality this app has been configured with ESLint based on AirBnb ES5 rules.

NB: I had wanted to use ES6 and transpile down to ES5 using this module, however, the lack of LiveView support made this an undesirable option.

You can manually check linting by running the following command from the CLI:

npm run eslint

I also recommend using an IDE other than Appcelerator Studio if you want proper linting support. I use Atom with https://atom.io/packages/linter-eslint

Pre-Commit

As a method of enforcing the ESLint rules the NPM pre-commit module is installed. This will run ESLint checking every time a GIT commit is performed. If the linting fails you will not be allowed to commit and push your code.

NB: I had wanted to use ghooks as it offers the full range of GIT hooks. However it (and other similar options) did not work with GIT GUI so pre-commit is the best option right now.

tistarter's People

Contributors

davehudson avatar

Stargazers

Brenton House avatar

Watchers

Michael Pauley avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.