Lately, I’ve had an intens discussion on Twitter with @mattapperson / @appersonlabs, @tonylukasavage, @ricardoalcocer, @bencoding and @aaronksaunders on the possibilities and reasons for using Carbon in Titanium’s new MVC framework Alloy. This discussion then somewhat continued in the Alloy Google Group.
To better understand the why (speed) and how (especially integration with Alloy) I’ve put together a Titanium project, which can be found on GitHub. The README explains it’s purpose and then concludes:
So in the end this might not be a case for Carbonizing Alloy, but the Titanium SDK instead. In 3.x the method
applyProperties()
will be added to the SDK for exactly the same reason I likeCarbon.UI.create()
. So… why not addTi.UI.create()
to the next SDK version and have Alloy make heavy use of this???
I hope this will contribute to improving an already impressive ecosystem. For that, I’ve opened a JIRA ticket for requesting this feature. Please watch the issue so it escalates and hopefully one day we can all do:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
// Ti.UI.create returns some kind of view-collection object var views = Ti.UI.create({ 'Window': { fullscreen: false, backgroundColor: '#fff', // Non-hierarchy views can also be added like: titleControl: { 'Label': { text: 'My title', font: { fontWeight: 'bold' } } }, // Child views are added through a 'children' property children: [ { 'View': { // Only views that have an 'id' can be referenced // in JS-land through a proxy object id: 'red', top: 100, left: 50, width: 200, height: 200, backgroundColor: '#f00', children: [ 'Label': { id: 'platform', // In Alloy this wouldn't be needed since platform // branching is done at built-time, but for usage // without Alloy this would be really nice to have. platform: ['android'], top: 25, right: 25, bottom: 25, left: 25, backgroundColor: '#0f0', text: 'I am green Android' }, 'Label': { id: 'platform', platform: ['ios'], top: 25, right: 25, bottom: 25, left: 25, backgroundColor: '#00f', text: 'I am blue iOS' }, // You could also include an existing Ti.UI object like this: someExistingView ] } }, { 'Label': { top: 400, left: 0, right: 0, height: Ti.UI.SIZE, text: 'I want Ti.UI.create()', // Events could also be added like this, but // it would compromise clear controller-view-separation onClick: myCallback, // Just like platform-branching, formFactor would be like: formFactor: ['tablet'] } } ] } }); // Views that have an 'id' can be referenced from JS-land var redView = views.get('redView'); // Views you won't need anymore can be destroyed, including children views.release('platform'); // Or just release all views.release(); |