@maccesar/titools 5.3.0 → 5.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +1 -1
- package/README.md +31 -60
- package/agents/ti-pro.md +3 -1
- package/commands/ti-audit.md +6 -4
- package/docs/examples.md +9 -0
- package/docs/knowledge-index.md +2 -1
- package/lib/config.js +1 -0
- package/package.json +1 -1
- package/skills/alloy-guides/SKILL.md +18 -179
- package/skills/alloy-guides/references/CLI_TASKS.md +17 -216
- package/skills/alloy-guides/references/CONCEPTS.md +27 -162
- package/skills/alloy-guides/references/CONTROLLERS.md +38 -236
- package/skills/alloy-guides/references/MODELS.md +47 -723
- package/skills/alloy-guides/references/MODELS_ADVANCED.md +21 -482
- package/skills/alloy-guides/references/VIEWS_DYNAMIC.md +12 -222
- package/skills/alloy-guides/references/VIEWS_STYLES.md +39 -358
- package/skills/alloy-guides/references/VIEWS_XML.md +36 -552
- package/skills/alloy-guides/references/WIDGETS.md +49 -127
- package/skills/alloy-howtos/SKILL.md +14 -169
- package/skills/alloy-howtos/references/best_practices.md +9 -113
- package/skills/alloy-howtos/references/cli_reference.md +18 -223
- package/skills/alloy-howtos/references/config_files.md +50 -133
- package/skills/alloy-howtos/references/debugging_troubleshooting.md +19 -63
- package/skills/alloy-howtos/references/samples.md +21 -138
- package/skills/ti-api/SKILL.md +10 -2
- package/skills/ti-api/references/api-android.md +36 -2
- package/skills/ti-api/references/api-app-platform.md +39 -3
- package/skills/ti-api/references/api-core.md +50 -18
- package/skills/ti-api/references/api-data-network.md +49 -35
- package/skills/ti-api/references/api-media.md +45 -27
- package/skills/ti-api/references/api-services.md +39 -9
- package/skills/ti-api/references/api-ui-android.md +33 -13
- package/skills/ti-api/references/api-ui-extras.md +41 -15
- package/skills/ti-api/references/api-ui-ios-animator.md +42 -26
- package/skills/ti-api/references/api-ui-ios.md +74 -2
- package/skills/ti-api/references/api-ui-lists.md +32 -16
- package/skills/ti-api/references/api-ui-text-input.md +34 -17
- package/skills/ti-api/references/api-ui-views.md +27 -1
- package/skills/ti-api/references/api-ui-windows-navigation.md +32 -18
- package/skills/ti-api/references/api-xml-global.md +66 -16
- package/skills/ti-create-release/SKILL.md +98 -0
- package/skills/ti-create-release/references/module-discovery.md +69 -0
- package/skills/ti-expert/references/adaptive-layouts.md +1 -1
- package/skills/ti-guides/SKILL.md +37 -76
- package/skills/ti-guides/references/advanced-data-and-images.md +122 -126
- package/skills/ti-guides/references/android-manifest.md +24 -83
- package/skills/ti-guides/references/app-distribution.md +31 -377
- package/skills/ti-guides/references/application-frameworks.md +127 -335
- package/skills/ti-guides/references/cli-reference.md +184 -633
- package/skills/ti-guides/references/commonjs-advanced.md +81 -231
- package/skills/ti-guides/references/compatibility-matrix.md +36 -75
- package/skills/ti-guides/references/hello-world.md +95 -70
- package/skills/ti-guides/references/hyperloop-native-access.md +52 -448
- package/skills/ti-guides/references/resources.md +174 -142
- package/skills/ti-guides/references/sdk-release-notes.md +28 -71
- package/skills/ti-guides/references/tiapp-config.md +222 -598
- package/skills/ti-howtos/SKILL.md +23 -123
- package/skills/ti-howtos/references/cross-platform-development.md +119 -324
- package/skills/ti-howtos/references/debugging-profiling.md +77 -445
- package/skills/ti-howtos/references/extending-titanium.md +199 -673
- package/skills/ti-howtos/references/local-data-sources.md +87 -300
- package/skills/ti-howtos/references/location-and-maps.md +86 -213
- package/skills/ti-howtos/references/media-apis.md +103 -223
- package/skills/ti-howtos/references/notification-services.md +86 -506
- package/skills/ti-howtos/references/remote-data-sources.md +97 -316
- package/skills/ti-howtos/references/using-modules.md +77 -133
- package/skills/ti-ui/SKILL.md +28 -143
- package/skills/ti-ui/references/icons-and-splash-screens.md +74 -403
- package/skills/ti-ui/references/layouts-and-positioning.md +175 -402
- package/skills/ti-ui/references/listviews-and-performance.md +100 -703
- package/skills/ti-ui/references/platform-conventions.md +180 -0
- package/skills/ti-ui/references/user-interface.md +43 -0
- package/skills/alloy-guides/references/VIEWS_WITHOUT_CONTROLLERS.md +0 -102
- package/skills/alloy-howtos/references/custom_tags.md +0 -148
- package/skills/ti-guides/references/coding-best-practices.md +0 -149
- package/skills/ti-guides/references/javascript-primer.md +0 -414
- package/skills/ti-guides/references/reserved-words.md +0 -36
- package/skills/ti-guides/references/style-and-conventions.md +0 -103
- package/skills/ti-howtos/references/android-platform-deep-dives.md +0 -624
- package/skills/ti-howtos/references/automation-fastlane-appium.md +0 -96
- package/skills/ti-howtos/references/buffer-codec-streams.md +0 -162
- package/skills/ti-howtos/references/google-maps-v2.md +0 -172
- package/skills/ti-howtos/references/ios-map-kit.md +0 -149
- package/skills/ti-howtos/references/ios-platform-deep-dives.md +0 -611
- package/skills/ti-howtos/references/tutorials.md +0 -565
- package/skills/ti-howtos/references/web-content-integration.md +0 -287
- package/skills/ti-howtos/references/webpack-build-pipeline.md +0 -124
- package/skills/ti-ui/references/accessibility-deep-dive.md +0 -288
- package/skills/ti-ui/references/animation-and-matrices.md +0 -569
- package/skills/ti-ui/references/application-structures.md +0 -626
- package/skills/ti-ui/references/custom-fonts-styling.md +0 -549
- package/skills/ti-ui/references/event-handling.md +0 -401
- package/skills/ti-ui/references/gestures.md +0 -448
- package/skills/ti-ui/references/orientation.md +0 -374
- package/skills/ti-ui/references/platform-ui-android.md +0 -727
- package/skills/ti-ui/references/platform-ui-ios.md +0 -576
- package/skills/ti-ui/references/scrolling-views.md +0 -288
- package/skills/ti-ui/references/tableviews.md +0 -542
|
@@ -1,379 +1,171 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Project structure
|
|
2
2
|
|
|
3
|
-
Framework options and architecture patterns for Titanium applications.
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
`ti create` writes about a dozen files, and which ones you edit depends on
|
|
5
|
+
whether the project is Classic or Alloy. This page is the tour.
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
- [Classic Titanium](#classic-titanium)
|
|
10
|
-
- [Choosing a framework](#choosing-a-framework)
|
|
11
|
-
- [Architecture patterns](#architecture-patterns)
|
|
12
|
-
- [Framework interoperability](#framework-interoperability)
|
|
13
|
-
- [Best practices](#best-practices)
|
|
14
|
-
- [Resources](#resources)
|
|
7
|
+
## What ti create generates
|
|
15
8
|
|
|
16
|
-
<!-- TOC-END -->
|
|
17
9
|
|
|
18
|
-
|
|
10
|
+
### Classic
|
|
19
11
|
|
|
20
|
-
Alloy is the official MVC framework for Titanium. It was developed by Appcelerator and is now maintained by TiDev.
|
|
21
|
-
|
|
22
|
-
### What Alloy provides
|
|
23
|
-
|
|
24
|
-
- MVC structure with models, views, and controllers
|
|
25
|
-
- Built-in libraries (Backbone.js, Underscore.js)
|
|
26
|
-
- XML views for declarative UI
|
|
27
|
-
- TSS for CSS-like styling
|
|
28
|
-
- Data binding between views and models
|
|
29
|
-
- Widgets for reusable UI components
|
|
30
|
-
- Model and collection sync with REST and SQL adapters
|
|
31
|
-
|
|
32
|
-
### Project structure
|
|
33
|
-
|
|
34
|
-
```
|
|
35
|
-
app/
|
|
36
|
-
├── controllers/ # UI logic
|
|
37
|
-
├── models/ # Data models
|
|
38
|
-
├── views/ # XML view definitions
|
|
39
|
-
├── styles/ # TSS style sheets
|
|
40
|
-
├── assets/ # Images, fonts
|
|
41
|
-
├── lib/ # CommonJS libraries
|
|
42
|
-
├── themes/ # Theming support
|
|
43
|
-
├── config.json # App configuration
|
|
44
|
-
└── alloy.js # Entry point
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### Sample Alloy code
|
|
48
|
-
|
|
49
|
-
View (XML):
|
|
50
|
-
```xml
|
|
51
|
-
<Alloy>
|
|
52
|
-
<Window class="container">
|
|
53
|
-
<Label id="title" onClick="doClick">Click Me</Label>
|
|
54
|
-
</Window>
|
|
55
|
-
</Alloy>
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
Style (TSS):
|
|
59
|
-
```css
|
|
60
|
-
".container": {
|
|
61
|
-
backgroundColor: "#fff"
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
"#title": {
|
|
65
|
-
color: "#000",
|
|
66
|
-
font: { fontSize: 18 }
|
|
67
|
-
}
|
|
68
12
|
```
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
13
|
+
Hello/
|
|
14
|
+
Resources/ your code and assets
|
|
15
|
+
app.js the entry point
|
|
16
|
+
semantic.colors.json
|
|
17
|
+
assets/images/ shared images
|
|
18
|
+
android/ Android-only assets
|
|
19
|
+
iphone/ iOS-only assets
|
|
20
|
+
platform/
|
|
21
|
+
android/ files copied verbatim into the native build
|
|
22
|
+
DefaultIcon.png source image for the generated iOS app icons
|
|
23
|
+
tiapp.xml app configuration
|
|
24
|
+
LICENSE
|
|
25
|
+
README.md
|
|
26
|
+
.vscode/ recommended extensions and settings
|
|
77
27
|
```
|
|
78
28
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
- Alloy guides: see the `alloy-guides` skill
|
|
82
|
-
- Alloy CLI: see `alloy-cli-advanced.md`
|
|
83
|
-
- Alloy data: see `alloy-data-mastery.md`
|
|
84
|
-
- Alloy widgets: see `alloy-widgets-and-themes.md`
|
|
85
|
-
|
|
86
|
-
### Angular integration
|
|
29
|
+
Everything you write lives in `Resources`. `app.js` runs first, and anything it
|
|
30
|
+
requires resolves relative to `Resources`.
|
|
87
31
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
### React community framework
|
|
91
|
-
|
|
92
|
-
A community React integration exists at https://github.com/nicolomonili/react-titanium (experimental).
|
|
93
|
-
|
|
94
|
-
### When to use Alloy
|
|
95
|
-
|
|
96
|
-
Use Alloy for:
|
|
97
|
-
- New projects (default choice)
|
|
98
|
-
- Teams that want MVC structure
|
|
99
|
-
- Projects that need data binding
|
|
100
|
-
- Rapid development with XML views
|
|
101
|
-
- Reusable components (widgets)
|
|
102
|
-
|
|
103
|
-
Consider alternatives for:
|
|
104
|
-
- Very simple apps
|
|
105
|
-
- Teams that prefer pure JavaScript
|
|
106
|
-
- Projects with unique architectural needs
|
|
107
|
-
|
|
108
|
-
---
|
|
109
|
-
|
|
110
|
-
## Classic Titanium
|
|
111
|
-
|
|
112
|
-
Classic Titanium means building apps without Alloy, using JavaScript and CommonJS modules.
|
|
113
|
-
|
|
114
|
-
### Project structure
|
|
32
|
+
### Alloy
|
|
115
33
|
|
|
116
34
|
```
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
35
|
+
Hello/
|
|
36
|
+
app/ your code
|
|
37
|
+
views/ XML layouts
|
|
38
|
+
index.xml
|
|
39
|
+
styles/ TSS styles
|
|
40
|
+
app.tss applies to the whole app
|
|
41
|
+
index.tss applies to index.xml
|
|
42
|
+
controllers/ JavaScript behaviour
|
|
43
|
+
index.js
|
|
44
|
+
models/ data models and collections
|
|
45
|
+
assets/ images, and semantic.colors.json
|
|
46
|
+
platform/ files copied verbatim into the native build
|
|
47
|
+
alloy.js runs before the first controller
|
|
48
|
+
config.json per-environment and per-platform settings
|
|
49
|
+
plugins/ti.alloy/ the compiler hook, installed by alloy new
|
|
50
|
+
Resources/ generated at build time, not yours to edit
|
|
51
|
+
DefaultIcon.png source image for the generated iOS app icons
|
|
52
|
+
tiapp.xml app configuration
|
|
53
|
+
.gitignore
|
|
125
54
|
```
|
|
126
55
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
```javascript
|
|
131
|
-
// Single namespace pattern
|
|
132
|
-
const app = {};
|
|
133
|
-
|
|
134
|
-
// Load components via require (Ti.include is deprecated)
|
|
135
|
-
const AppWindow = require('ui/ApplicationWindow');
|
|
136
|
-
|
|
137
|
-
// Create and open window
|
|
138
|
-
app.mainWindow = AppWindow.createApplicationWindow();
|
|
139
|
-
app.mainWindow.open();
|
|
140
|
-
```
|
|
56
|
+
Everything you write lives in `app`. `Resources` is Alloy's output: each build
|
|
57
|
+
compiles `app` into Classic JavaScript and writes it there, overwriting what was
|
|
58
|
+
there before.
|
|
141
59
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
app.ui = app.ui || {};
|
|
146
|
-
|
|
147
|
-
app.ui.createApplicationWindow = () => {
|
|
148
|
-
const win = Ti.UI.createWindow({
|
|
149
|
-
backgroundColor: 'white',
|
|
150
|
-
title: 'My App'
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
const label = Ti.UI.createLabel({
|
|
154
|
-
text: 'Hello World',
|
|
155
|
-
color: '#000'
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
win.add(label);
|
|
159
|
-
return win;
|
|
160
|
-
};
|
|
161
|
-
```
|
|
60
|
+
`ti create --alloy` leaves the Classic template's `Resources/app.js` behind on
|
|
61
|
+
first run. It is ignored from the next build onwards, and the generated
|
|
62
|
+
`.gitignore` excludes the whole directory.
|
|
162
63
|
|
|
163
|
-
### CommonJS pattern (recommended)
|
|
164
64
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
// Private variables
|
|
168
|
-
const privateData = 'secret';
|
|
65
|
+
Two files at the root exist for the app stores rather than the build:
|
|
66
|
+
`MarketplaceArtwork.png` and `iTunesConnect.png`, both placeholders Alloy adds.
|
|
169
67
|
|
|
170
|
-
|
|
171
|
-
exports.createWindow = () => {
|
|
172
|
-
return Ti.UI.createWindow({
|
|
173
|
-
backgroundColor: 'white'
|
|
174
|
-
});
|
|
175
|
-
};
|
|
68
|
+
## Where each kind of file goes
|
|
176
69
|
|
|
177
|
-
|
|
178
|
-
return privateData;
|
|
179
|
-
};
|
|
180
|
-
```
|
|
70
|
+
**Code** goes in `Resources` (Classic) or `app` (Alloy).
|
|
181
71
|
|
|
182
|
-
app.
|
|
183
|
-
```javascript
|
|
184
|
-
const myModule = require('myModule');
|
|
185
|
-
const win = myModule.createWindow();
|
|
186
|
-
win.open();
|
|
187
|
-
```
|
|
72
|
+
**Images and other assets** go under `Resources/` in Classic or `app/assets/` in Alloy. Runtime paths are relative to the resource root: `Resources/assets/images/logo.png` uses `assets/images/logo.png`, while `app/assets/images/logo.png` becomes `images/logo.png`.
|
|
188
73
|
|
|
189
|
-
|
|
74
|
+
**Platform-specific assets** go in a directory named for the platform:
|
|
75
|
+
`Resources/android`, `Resources/iphone`, `app/assets/android`,
|
|
76
|
+
`app/assets/iphone`. Titanium picks the matching one at build time and leaves
|
|
77
|
+
the rest out of the package, so an Android build does not carry iOS artwork.
|
|
190
78
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
- Fine-grained control over UI creation
|
|
196
|
-
- Learning the Titanium API directly
|
|
79
|
+
**Native project files** go in `platform` (Classic) or `app/platform` (Alloy).
|
|
80
|
+
Contents are copied into the generated native project without being processed,
|
|
81
|
+
which is how the template ships `platform/android/build.gradle` and the launcher
|
|
82
|
+
icon resources. Use it when you need to reach the native build directly.
|
|
197
83
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
84
|
+
**Icons** are not shared between the platforms, despite the name. iOS
|
|
85
|
+
generates its whole icon set from `DefaultIcon.png` at the project root.
|
|
86
|
+
Android never reads that file: its launcher icon is the adaptive-icon set under
|
|
87
|
+
`platform/android/res/mipmap-*`, which `tiapp.xml` points at with
|
|
88
|
+
`android:icon="@mipmap/ic_launcher"`. See
|
|
89
|
+
[Icons and launch screens](https://titaniumsdk.com/docs/build/ui/icons-and-launch-screens).
|
|
203
90
|
|
|
204
|
-
|
|
91
|
+
## tiapp.xml
|
|
205
92
|
|
|
206
|
-
|
|
93
|
+
`tiapp.xml` is the app's configuration: identity, which platforms it targets,
|
|
94
|
+
which SDK builds it, and the settings that end up in the native manifests. Both
|
|
95
|
+
project types use it unchanged.
|
|
207
96
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
---
|
|
225
|
-
|
|
226
|
-
## Architecture patterns
|
|
227
|
-
|
|
228
|
-
### Namespaced pattern
|
|
229
|
-
|
|
230
|
-
Classic Titanium pattern with a single global namespace:
|
|
231
|
-
|
|
232
|
-
```javascript
|
|
233
|
-
const app = {
|
|
234
|
-
models: {},
|
|
235
|
-
views: {},
|
|
236
|
-
controllers: {},
|
|
237
|
-
|
|
238
|
-
init() {
|
|
239
|
-
// Initialize app
|
|
240
|
-
},
|
|
241
|
-
|
|
242
|
-
run() {
|
|
243
|
-
// Run app
|
|
244
|
-
}
|
|
245
|
-
};
|
|
246
|
-
|
|
247
|
-
app.init();
|
|
248
|
-
app.run();
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
### CommonJS modules
|
|
252
|
-
|
|
253
|
-
Modern JavaScript pattern for Titanium:
|
|
254
|
-
|
|
255
|
-
models/user.js:
|
|
256
|
-
```javascript
|
|
257
|
-
exports.create = (attrs) => {
|
|
258
|
-
return {
|
|
259
|
-
name: attrs.name,
|
|
260
|
-
email: attrs.email,
|
|
261
|
-
save() {
|
|
262
|
-
// Save to database
|
|
263
|
-
}
|
|
264
|
-
};
|
|
265
|
-
};
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
controllers/user.js:
|
|
269
|
-
```javascript
|
|
270
|
-
const User = require('models/user');
|
|
271
|
-
|
|
272
|
-
exports.register = (data) => {
|
|
273
|
-
const user = User.create(data);
|
|
274
|
-
user.save();
|
|
275
|
-
return user;
|
|
276
|
-
};
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
### MVC with Alloy (built-in)
|
|
280
|
-
|
|
281
|
-
Alloy enforces MVC:
|
|
282
|
-
|
|
283
|
-
```
|
|
284
|
-
app/
|
|
285
|
-
├── controllers/userController.js # Logic
|
|
286
|
-
├── models/userModel.js # Data
|
|
287
|
-
└── views/userView.xml # Presentation
|
|
288
|
-
```
|
|
289
|
-
|
|
290
|
-
### Repository pattern
|
|
291
|
-
|
|
292
|
-
Separate data access from business logic:
|
|
293
|
-
|
|
294
|
-
repositories/userRepository.js:
|
|
295
|
-
```javascript
|
|
296
|
-
exports.findById = (id) => {
|
|
297
|
-
// Database call
|
|
298
|
-
return db.query('SELECT * FROM users WHERE id = ?', [id]);
|
|
299
|
-
};
|
|
300
|
-
|
|
301
|
-
exports.save = (user) => {
|
|
302
|
-
// Insert/update
|
|
303
|
-
return db.execute('INSERT INTO users ...');
|
|
304
|
-
};
|
|
305
|
-
```
|
|
306
|
-
|
|
307
|
-
services/userService.js:
|
|
308
|
-
```javascript
|
|
309
|
-
const repo = require('repositories/userRepository');
|
|
310
|
-
|
|
311
|
-
exports.register = (data) => {
|
|
312
|
-
// Business logic
|
|
313
|
-
if (!data.email) {
|
|
314
|
-
throw new Error('Email required');
|
|
315
|
-
}
|
|
316
|
-
return repo.save(data);
|
|
317
|
-
};
|
|
97
|
+
```xml
|
|
98
|
+
<ti:app xmlns:ti="http://ti.titaniumsdk.com">
|
|
99
|
+
<id>com.example.hello</id>
|
|
100
|
+
<name>Hello</name>
|
|
101
|
+
<version>1.0</version>
|
|
102
|
+
<guid>f0391a5d-2689-47cf-a6aa-df0f849fbe50</guid>
|
|
103
|
+
<icon>appicon.png</icon>
|
|
104
|
+
<property name="ti.ui.defaultunit" type="string">dp</property>
|
|
105
|
+
<deployment-targets>
|
|
106
|
+
<target device="android">true</target>
|
|
107
|
+
<target device="iphone">true</target>
|
|
108
|
+
<target device="ipad">false</target>
|
|
109
|
+
</deployment-targets>
|
|
110
|
+
<sdk-version>13.4.1.GA</sdk-version>
|
|
111
|
+
</ti:app>
|
|
318
112
|
```
|
|
319
113
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
114
|
+
| Element | What it controls |
|
|
115
|
+
| ------- | ---------------- |
|
|
116
|
+
| `id` | The Android package name and the iOS bundle identifier |
|
|
117
|
+
| `name` | The name under the app icon |
|
|
118
|
+
| `version` | The version shown in the stores |
|
|
119
|
+
| `guid` | Generated per project, and how tooling recognises this app |
|
|
120
|
+
| `sdk-version` | Which installed SDK builds the project |
|
|
121
|
+
| `deployment-targets` | Which platforms and device families to build for |
|
|
122
|
+
| `property` | Values readable at runtime through `Ti.App.Properties` |
|
|
123
|
+
| `modules` | Native modules the app uses |
|
|
124
|
+
| `plugins` | Build-time plugins, which is how `ti.alloy` is wired in |
|
|
323
125
|
|
|
324
|
-
|
|
126
|
+
> [!IMPORTANT]
|
|
127
|
+
> Changing `id` after publishing means a new listing in both stores rather than
|
|
128
|
+
> an update to the existing one. Set it to a domain you control when you create
|
|
129
|
+
> the project.
|
|
325
130
|
|
|
326
|
-
|
|
131
|
+
`guid` is generated for each project. Copying a `tiapp.xml` from another app
|
|
132
|
+
carries its guid along, so change it when you do that.
|
|
327
133
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
$.label.text = data;
|
|
333
|
-
```
|
|
134
|
+
Two elements hold native configuration directly. `<ios><plist>` takes `Info.plist`
|
|
135
|
+
keys, which is where permission usage strings and supported orientations go.
|
|
136
|
+
`<android><manifest>` takes `AndroidManifest.xml` fragments, for permissions,
|
|
137
|
+
activities and services. Titanium merges both into the generated native project.
|
|
334
138
|
|
|
335
|
-
|
|
139
|
+
Every element is documented in the
|
|
140
|
+
[tiapp.xml reference](https://titaniumsdk.com/docs/reference/tiapp-xml).
|
|
336
141
|
|
|
337
|
-
|
|
338
|
-
2. Move business logic to `controllers/` or `lib/`.
|
|
339
|
-
3. Convert UI creation to `views/` (XML).
|
|
340
|
-
4. Create `styles/` (TSS) from inline styles.
|
|
341
|
-
5. Update data access to use `models/`.
|
|
142
|
+
## Generated directories
|
|
342
143
|
|
|
343
|
-
|
|
144
|
+
`build/` appears on the first build and holds the generated native project: an
|
|
145
|
+
Xcode project for iOS, a Gradle project for Android, and the compiled output.
|
|
146
|
+
Nothing in it is yours to edit, because the next build overwrites it.
|
|
344
147
|
|
|
345
|
-
|
|
148
|
+
Deleting `build/` forces a full rebuild, which is the fix when a build fails in
|
|
149
|
+
a way the source does not explain. `ti clean` does the same thing.
|
|
346
150
|
|
|
347
|
-
|
|
151
|
+
In an Alloy project `Resources/` is generated too, from `app/`.
|
|
348
152
|
|
|
349
|
-
|
|
350
|
-
2. Use data binding and avoid manual view updates.
|
|
351
|
-
3. Use widgets for reusable UI.
|
|
352
|
-
4. Use themes for styling variants.
|
|
353
|
-
5. Keep controllers lean and move business logic to `lib/`.
|
|
153
|
+
## What to commit
|
|
354
154
|
|
|
355
|
-
|
|
155
|
+
Commit `tiapp.xml`, your source, your assets, `DefaultIcon.png` and `platform/`.
|
|
356
156
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
5. Document patterns so the team shares the same structure.
|
|
157
|
+
Do not commit `build/`, and in an Alloy project do not commit `Resources/` or
|
|
158
|
+
the top-level `platform/` and `i18n/` directories, which Alloy moved under
|
|
159
|
+
`app/`. The `.gitignore` that `alloy new` writes covers all of these. A Classic
|
|
160
|
+
project gets no `.gitignore`, so add one with `build/` in it.
|
|
362
161
|
|
|
363
|
-
|
|
162
|
+
Keystores and signing credentials do not belong in the repository at all.
|
|
364
163
|
|
|
365
|
-
|
|
366
|
-
2. Add try/catch around critical code paths.
|
|
367
|
-
3. Use `Ti.API` for logging.
|
|
368
|
-
4. Follow `style-and-conventions.md` for code style.
|
|
369
|
-
5. Write unit tests for business logic.
|
|
164
|
+
## Next
|
|
370
165
|
|
|
371
|
-
|
|
166
|
+
[User interface](https://titaniumsdk.com/docs/build/ui) covers building screens: layout, lists, and
|
|
167
|
+
where the platforms differ.
|
|
372
168
|
|
|
373
|
-
##
|
|
169
|
+
## Framework choice
|
|
374
170
|
|
|
375
|
-
|
|
376
|
-
- CommonJS advanced: see `commonjs-advanced.md`
|
|
377
|
-
- Coding best practices: see `coding-best-practices.md`
|
|
378
|
-
- JavaScript primer: see `javascript-primer.md`
|
|
379
|
-
- Alloy CLI: see `alloy-cli-advanced.md`
|
|
171
|
+
Classic creates UI with JavaScript calls. Alloy compiles XML views, TSS styles and JavaScript controllers into the same runtime, with model/collection binding and widgets. For the complete current MVC workflow load `alloy-guides`; for creation and first run use [project creation](hello-world.md). `app/config.json` is the Alloy configuration file and `app/lib/foo.js` is required as `require('foo')`.
|