6

PhoneGap offers a nice solution for writing cross-platform apps with HTML5 and JavaScript.

But I would like to use Interface Builder for the UI, and just write all the controller code in Javascript instead of Objective-C (with of course the option to mix and match and especially call into any Objective-C libraries that I may need).

Is there a framework for this? Something akin to what CamelBones does for Perl.

The reason for wanting to do this is that the non-UI code can ideally be written in JavaScript to be reused for the web version, an possible future Android PhoneGap version, and the server-side (node.js).

Thilo
  • 257,207
  • 101
  • 511
  • 656
  • You could try [Cappuccino](http://cappuccino.org/) or [SproutCore](http://www.sproutcore.com/), though that's really targeted toward building for the web using Cocoa-like tech. My advice would be just to suck it up and use Objective-C. It isn't really all that bad ;) – Brian Donovan Jan 13 '11 at 00:12
  • 2
    Coincidentally, there's an O'Reilly book titled *Learning the iOS SDK for JavaScript Programmers*, http://oreilly.com/catalog/0636920010265 but it has nothing to do with writing apps *in JavaScript* and everything to do with making the jump to Obj-C ;) – BoltClock Jan 13 '11 at 00:15
  • 1
    I'm not gonna buy that book then... – Thilo Jan 13 '11 at 00:30
  • and that O'Reilly book is not such a great read, IMHO - its a very long-winded with not enough sample code. I eventually stopped reading it and just watched youtube tutorials to get a grasp of objective-c – tim Jul 06 '12 at 02:27

5 Answers5

4

You could try using Appcelerator's Titanium product. It lets you write native iPhone apps in HTML+Javascript.

Check it out here. I haven't used it, but it seems like what you want.

i_am_jorf
  • 53,608
  • 15
  • 131
  • 222
  • This does look like it can make use of native UI components. No mention of Interface Builder, though, and it still seems to run in a WebView. I guess if there is a good enough abstraction from the HTML/CSS so that I do not have to touch that, it would work (I really do not want to code my UI, I want a builder). – Thilo Jan 13 '11 at 01:17
  • Here is a comparison between Titanium and PhoneGap (even though the accepted answer appears to be wrong): http://stackoverflow.com/questions/1482586/comparison-between-corona-phonegap-titanium – Thilo Jan 13 '11 at 01:24
  • Apparently, they switched from using a WebView to something more native recently, so it probably is very close to what I was looking for: http://developer.appcelerator.com/question/71/what-happened-to-html--css – Thilo Jan 13 '11 at 01:28
3

The other possibility is to use iOS Javascript Bridge to write an app in Javascript.

https://github.com/coolbloke1324/iOS-JavaScript-Bridge

motou
  • 726
  • 4
  • 12
  • That looks cool. "Your JS is contained and executed inside a custom build of JavaScriptCore so that no private API calls are made". Too bad you have to ship your own copy of that library. I wonder how big it is. Would be nice of Apple to make it a public API. – Thilo Feb 14 '12 at 00:53
0

Here's an article that mentions a few alternatives to using Objective-C

Michael Rader
  • 5,839
  • 8
  • 33
  • 43
0

You can try JSCocoa. It lets you write Cocoa apps in JavaScript, like a bridge.

It works on a Mac and iPhone. It also works with Interface Builder while you develop.

Thai
  • 10,746
  • 2
  • 45
  • 57
  • Says it works on the iPhone *Simulator*, waiting for a port of libffi: http://code.google.com/p/jscocoa/wiki/iPhone – Thilo Jan 13 '11 at 02:45
-1

Just stumbled upon this (old) question but wanted to contribute by mentioning NibleKit (http://www.nimblekit.com/index.php) that let's you build native iOS apps with just HTML & Javascript.

lkaradashkov
  • 8,609
  • 1
  • 15
  • 12
  • I found that same link but on the current date (October 02, 2014) it has the following notice: "NimbleKit was acquired by Sencha inc, selling licenses is stopped until further notice". – afeldspar Oct 02 '14 at 16:43