8

Is it possible to use only C++ to create iOS apps? Is there any downside to that? I read somewhere that you have to use a mix of objective C and C++ if you want to use C++ that bad.

1
7

I'll add a bit more color to the explanation given by Paul above.

There are two main areas where you must interface your c++ with ObjC to make a functional app:

  • You must interface with the runloop provided by UIKit to receive event notifications such as touches and app state changes.

  • To display content on screen, you need to either wrap UIKit / CoreAnimation or provide content via the EAGL / GLKit apis (OpenGL ES).

If you want access other capabilities of the device, they're typically only provided via an ObjC api, though sometimes they are also available at a lower level with a C API (such as audio and the address book).

In general, I tend to make most of the app ObjC, but then use C++ to help with the efficient implementation of some subsystems. In general, modern ObjC plays very well with C++ as they use both internally at Apple.

4

For the user interface on iOS you need objective C, for the remainder you can use C++. Wether or not using C++/Obj C and not pure objective C depends primarily on your C++ skills. If you are already fluent in C++, doing part of the development in that might pay off. If not, going for pure obj C is probably a better choice. See also

stackoverflow.com/questions/8759573/utilizing-c-in-ios-and-mac-os-x-applications

Not the answer you're looking for? Browse other questions tagged or ask your own question.