> On Oct 15, 2019, at 9:40 AM, Richard Charles via Cocoa-dev > <cocoa-dev@lists.apple.com> wrote: > > 2. Another option is Swift but it has zero integration with C++. So this is > really not a choice at all.
Swift integrates with C. So you can declare C APIs to your C++ codebase, and call those from Swift. This does mean writing a lot of C++ wrapper code in the form of extern "C" functions that call your C++ methods. Which is admittedly extra work, but hardly rocket science. For context: I work on a database library[1] implemented in C++ that provides exactly such a C API, which is then used by higher-layer frameworks written in Objective-C, Swift, Java, and C#. So I know this works and is not an unreasonable amount of work. Here [2] is an example source file if you want to see what it looks like. (Note that some of the boilerplate is to catch exceptions thrown by the C++ layer; if your C++ doesn't use exceptions, you don't need that.) —Jens [1]: https://github.com/couchbase/couchbase-lite-core [2]: https://github.com/couchbase/couchbase-lite-core/blob/master/C/c4DocExpiration.cc _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com