Using C++ libraries in an iOS project

Being an iOS developer, I spend most of my time writing Objective C code. It is fun and rewarding but often not enough to fulfil all of my product’s goals. One of the most important ones is portability. To create a successful mobile application these days we have to target at least two of the biggest platforms: Android and iOS. Does it mean that we have to implement the same functionality twice? Yes, to some extent. While we can’t avoid developing platform specific parts of our app (assuming that we want to develop in native code), we always have the option of extracting common business logic into a single C++ library that can be shared between the Android and iOS clients. Following this path can save us a lot of development effort and potentially increase the app’s performance by bypassing Objective C message sending infrastructure. In this post I will focus on how to build a simple C++ library and start using it within your Xcode project.

Continue reading