tags:

views:

95

answers:

4

Hello all,

We have a program developed for Windows, the business layer is in pure C++ without any Windows related stuff(e.g CString) and we plan to migrate it to IPhone.

What I'm thinking is that we can use the exisiting code (with little changes if needed) and use Object-C to develop a UI. Is this idea possible?

Best regards, Zach


Edit

Another question: Are STL and boost well supported?

+1  A: 

Yes, that sounds like a great candidate for porting. "Objective-C++" allows you to use and call C++ from within Obj-C objects. Assuming your business logic is easily separable, and doesn't have too many win32-isms in it that require explicit porting work, you should be fine doing this.

quixoto
+3  A: 

Oh yes, this is entirely possible. You'd be using Objective-C++, which is merely a different file extension. (You'd save your .cpp files as .mm files).

Jacob Relkin
+1  A: 

yes definitely!, you might want to look at objective-c++ at the docs. There are a few gotchas that you should be careful off. Basically you are implementing the model layer in c++ and the view, controller layer in objective-c, this is quite a common design pattern used in many cross-platform projects.

A: 

I think that one of the strongest reasons for having the UI developed using Cocoa is down to, "when in Rome, do as the Romans do". A fully native experience can only reasonably be achieved using Cocoa and your users will love you for it. Similarly I'd be using .NET for developing the UI on Windows.

Our applications end up having about 70% of its code base remaining portable across platforms following this approach.

Christopher Hunt