My objective is simple:
I wish to write a library that exposes a C++ class, but calls Obj-C code behind the scenes. I wish to write the code such that, as far as a C++ programmer and his or her favorite compiler care, it's all C++.
I see people putting C++ & Objective-C code in the same .h file, but I'm not sure if/how that would work for my case. It seems more logical for me to have my C++ class declarations in 1 header and my Objective-C @interface stuff in another, and have one .mm file where I use both headers.
Edit: Option 2, for the Googlers, would be to forget about Objective-C++. As pointed out on Stack Overflow, you can run Objective-C code from C++ using the runtime library, as described here:
https://developer.apple.com/library...f/#//apple_ref/doc/uid/TP40001418-CH1g-119787
I wish to write a library that exposes a C++ class, but calls Obj-C code behind the scenes. I wish to write the code such that, as far as a C++ programmer and his or her favorite compiler care, it's all C++.
I see people putting C++ & Objective-C code in the same .h file, but I'm not sure if/how that would work for my case. It seems more logical for me to have my C++ class declarations in 1 header and my Objective-C @interface stuff in another, and have one .mm file where I use both headers.
Edit: Option 2, for the Googlers, would be to forget about Objective-C++. As pointed out on Stack Overflow, you can run Objective-C code from C++ using the runtime library, as described here:
https://developer.apple.com/library...f/#//apple_ref/doc/uid/TP40001418-CH1g-119787
Last edited: