Language Mixing: Model and View
-
19-09-2019 - |
Question
Consider developing an application where the model will be written in C++ (with Boost), and the view will be written in Objective-C++ (with Cocoa Touch).
Where are some examples showing how to integrate C++ and Objective-C++ for developing iPhone applications?
Solution
Take it straight from the source: Apple has documentation on using C++ With Objective-C.
There really isn't much more to it besides, in my opinion, trying to keep the C++ and Objective-C parts as cleanly seperated as possible.
In your case it comes natural:
- limit definition of C++ classes et al to the C++ model
- restrict the Objective-C part to the view related code and using the C++ model
I don't know of any actual simple examples, but any cross-platform project that has a native GUI on the mac uses the same approach. One mostly clean example would be the Chromium source.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow