views:

97

answers:

5

I want to create a gui program in linux which I eventually might move to the iphone. What programming language and GUI framework should I use to make this easiest?

I'd assume using Objective-C would be best, since gcc will compile that, but are there GUI frameworks that work with Objective-C that are similar to Cocoa and won't require much rewriting? (apart from obvious input differences and screen shifting when iphone keyboard appears, etc.) (Objective-C + Cocoa seems to be the only language that iphone supports)

Thanks,

Dan

+1  A: 

I've found this: http://www.cocotron.org/

However the Iphone is a completely different beast, Iphone Cocoa is not the same as Cocoa on Mac OS X, at least not the UI parts.

adamse
A: 

As I understand it, Objective-C is a superset of C. I think C programs can be compiled in xcode and moved on to the iPhone.

Now, dealing with libraries is another thing altogether.

Bill K
A: 

There really isn't a good solution to this. The only thing I might suggest is Flash CS5. With it you could compile to AIR for linux and to a native iPhone app. It isn't really flash on the iphone. It's a way to compile a flash project down to a native iphone app.

http://labs.adobe.com/technologies/flashcs5/appsfor_iphone/

Joe Cannatti
+3  A: 

Your question is really a classic question of how to architect a cross-platform application. You essentially have two choices:

  1. Implement the application model in cross-platform code with a platform specific UI. You can compile C and C++ easily for the iPhone, so I'd go with one of those. You can use Objective-C++ (like Objective-C is to C, Objective-C++ is a superset of C++) to bridge your Objective-C UI to this model layer for the iPhone. Naturally you would use some other UI toolkit for the linux version. The only other realistic alternative is to write the backend in C# for the Mono runtime. You can use MonoTouch to compile a C# app for the iPhone (though you'll need a Mac to actually deploy it). Again you can write the model in standard C#/.Net, but you'll have to use the UIKit for MonoTouch to write the UI---essentially it's still a platform specific UI, but you can use C# and .Net instead of C++/boost/etc. for the backend if that's your preference.

  2. Use a fully cross-platform library. There are none for the iPhone yet, though MonoTouch is perhaps the closest (see above).

So, really, your choices are Objective-C/C/C++ or C# (via Mono). You can use the GNUStep toolchain and libraries to play around with Objective-C on linux, but I wouldn't recommend writing the whole app using GNUStep as there are enough library differences between GNUStep and modern Cocoa to make it essentially a different platform.

Barry Wark
A: 

It would be better to start with a Mac (Cocoa) application and then port that to the iPhone later if you need to. That way the port would be a relatively minor effort. Of course you would need to get a Mac to do this, but a Mac Mini is only a few hundred bucks and you can use existing peripherals with it, and then sell it on eBay later if you no longer need it.

Paul R