Can I write iOS (Cocoa) apps in JavaScript?
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).
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.
The other possibility is to use iOS Javascript Bridge to write an app in Javascript.
https://github.com/coolbloke1324/iOS-JavaScript-Bridge
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.
Here's an article that mentions a few alternatives to using Objective-C
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.
精彩评论