4

I'm a little confused about this. Titanium is bragging about being able to style with CSS, program with javascript and create with HTML5, whilst making the final product native to the platform. How is this possible? If I'm writing in JS/HTML/CSS then won't they be run within the browser? Making them non-native?

Will Hartung
  • 115,893
  • 19
  • 128
  • 203
dotty
  • 40,405
  • 66
  • 150
  • 195

5 Answers5

7

See jhaynie's explanation of how the Titanium Mobile SDK is used to compile to native code. In essence, the Titanium Mobile SDK creates a mapping between their APIs in javascript and the native APIs of the target platform.

Community
  • 1
  • 1
glorifiedHacker
  • 6,410
  • 2
  • 22
  • 26
0

Titanium code are written in core JavaScript and code is then converted into native code(i.e. objective c or java) But when you use HTML and CSS into titanium you need to render them into "WebView" a browser without address bar. So in that sense titanium is completely native.

ducktyped
  • 4,354
  • 4
  • 26
  • 38
  • So the HTML/CSS is not native? It's an application within an application (WebView inside an application). – dotty Aug 11 '11 at 10:45
  • HTML/CSS is not native as look n feel everything on DOM is designed by HTML/CSS(PhoneGap), that means it does not use native look n feel. Performance is also very slow comparing native. In Titanium you uses UIWebView only when you need to render some page from a remote website, otherwise better to go with native API calls. – ducktyped Aug 12 '11 at 06:05
0

You code a Titanium Mobile app in js using their API that 'bridges' your code to the native API. You don't use html/css at all unless you want to include a webview with local content.

doppioslash
  • 1,276
  • 11
  • 14
0

It's possible you are looking at old documentation. Titanium used to use HTML/CSS/JavaScript for creating applications which did not use native UIs but as of 0.9 is more of a JavaScript abstraction of a generic mobile device. This means you won't be using HTML or CSS to build your app and the process bears little resemblance to building a web app. Other tools like PhoneGap use the web app model in place of a native UI.

That said, you can create a web view (in-app web browser) in Titanium which you can use to show HTML5 content if you so desire. Also, as of Titanium 1.5, you can also use a CSS-style language called JSS to separate your JavaScript application model from your content.

Brian Nickel
  • 26,890
  • 5
  • 80
  • 110
-1

Apple iOS has a "WebView" which is basically a browser window under control of the program. They take your code, plop it in to a WebView and wrap some infrastructure around it, and compile and ship it as a "native" program.

Will Hartung
  • 115,893
  • 19
  • 128
  • 203
  • ...So it's not native at all? – dotty Aug 10 '11 at 23:43
  • Your code is not "native", but the application is. That is, it doesn't rely on the browser, it doesn't have to connect to the internet if it doesn't want to, people can't (easily) just download you code from the internet if it were a web app, etc. It has native characteristics, and will have to go through Apple approval, etc., but it's going to essentially perform that same as a "web app" when it's all said and done. – Will Hartung Aug 10 '11 at 23:47
  • 5
    I believe this answer is based on an outdated or incorrect understanding of how the Titanium SDK works. – glorifiedHacker Aug 10 '11 at 23:55
  • Sorry, @WillHartung, but I think you are confusing Titanium with Cordova (PhoneGap). Titanium has APIs that translate directly into native UI components. It doesn't even run the JS code in the browser, but uses their own engine. Although, I agree that I wouldn't say that the code is native, the UI is native, and that gives the tool a leg up over every other cross-platform approach out there so far. – Brian Genisio Aug 27 '12 at 02:36
  • This answer is certainly wrong. I think Will must be thinking of PhoneGap. – ZettaGeek Nov 28 '12 at 15:21