Subject: iPhone: How does this work exactly

Original Post Dave Merwin's Avatar

Dave Merwin

29 Dec, 2009 06:23 PM via web

I've been having discussions with team mates about Titanium. I'm really jazzed about the platform, but I need to answer some questions.

I was able to create a demo from start to finish in 1.5 hours. Really sweet. And Titanium created an iPhone SDK Project for me.

However, it was just a reference into a bunch of libraries.

SO my question is... what does Titanium do with the JS files when it builds the iPhone project? Please be as technical as you can.

Thanks.

  1. 2 Posted by Dave Merwin on 29 Dec, 2009 06:26 PM

    Dave Merwin's Avatar

    One thing we'd like to do is start the prject with Titanium and then pass off the iPhone project that is generated at build to a dev team to tweak if need be in Obj-C. But it looks like Titanium is writing right to byte code. Is that true?

  2. Support Staff 3 Posted by Nolan Wright on 29 Dec, 2009 07:04 PM

    Nolan Wright's Avatar

    Titanium takes your JS code and places it into an Objective-C file at
    compile time. The JS still executes at runtime and communicates with
    our Objective-C API via a custom bridge.

    Our platform is modular. We build out our functionality as modules,
    and if you have experienced Objective-C developers, they can build
    custom modules that can be used by JavaScript developers. We are
    working to improve our module API in the upcoming 0.9 release to make
    it much easier to extend our platform.

  3. 4 Posted by Dave Merwin on 29 Dec, 2009 07:09 PM

    Dave Merwin's Avatar

    Thanks so much for your reply! So it's NOT writing to bytecode. I want to make sure I understand...

    The JS is actually communicating with the Obj-C API via a bridge. What is that bridge then? Obj-C?

  4. Support Staff 5 Posted by Nolan Wright on 29 Dec, 2009 07:12 PM

    Nolan Wright's Avatar

    yes, currently, it's a lightweight XHR bridge between JS and Objective-
    C.

    we do not write bytecode.

  5. 6 Posted by Dave Merwin on 29 Dec, 2009 09:58 PM

    Dave Merwin's Avatar

    So, the JavaScript sends a call VIA XHR to the Obj-C libraries. You use the iPhone libraries.

    So when I use the Titanium API, I'm usung an XHR protocol to the iPhone SDK libraries for the supported UI API Libraries.

    For example... I create a JS Table in Titanium with the API calls that are allowed. When the project is built, the XHR takes your API and tells it to plug into the proper iPhone SDK library. Is that close?

  6. Support Staff 7 Posted by Nolan Wright on 30 Dec, 2009 12:23 AM

    Nolan Wright's Avatar

    Yes, and we have our own Objective-C API that uses the iPhone SDK.

    At runtime, your JS makes calls to our Objective-C API (which in turns
    uses the iPhoneSDK). In the case of a table view, our JS call (via
    the bridge) results in the construction of a true native table view.

    does that help?

  7. 8 Posted by Dave Merwin on 30 Dec, 2009 12:27 AM

    Dave Merwin's Avatar

    Thanks so much. That REALLY helps.

  8. 9 Posted by Swaroop Hegde on 20 Jan, 2010 10:34 AM

    Swaroop Hegde's Avatar

    I was told (misinformed) that phonegap creates a JS bridge while Titanium writes bytecode. Thanks for clearing it out.

Reply to this discussion

Preview Comments are parsed with Markdown. Help with syntax

Attached Files

You can attach files up to 10MB

How many minutes are in an hour?

Recent Discussions

13 Mar, 2010 01:38 PM
13 Mar, 2010 12:39 PM
13 Mar, 2010 11:06 AM
13 Mar, 2010 10:58 AM
13 Mar, 2010 09:02 AM