Swift and the future of JUCE on the Mac

For those of you that missed the announcement Apple debuted a new programming language at their recent developer conference:




This is probably good news for most iOS and Mac developers since it's a much more modern langauge than ObjC but it seems to be bad news for those of us that rely on C++ for cross-platform development. Merging C++ and ObjC was very easy since they are compatible at the source code level. This is something JUCE relies on for Mac integration, at least as far as I can tell from browsing the source.


Swift, however can't directly call C++ code. C++ code will first have to be wrapped in C or ObjC++ before it can be used. This seems likely to entail quite a bit of work for those of us with large codebases, and perhaps for JUCE as well. Or am I misreading things and JUCE's exposure to the ObjC APIs on the Mac isn't that extensive? Certainly this isn't an emergency since ObjC will be supported for at least a few more years but, given Apple's history, it's not hard to imagine that Swift will eventually be mandatory for development on their platforms.



I don't think it's a problem - swift can call C and obj-C, so interfacing to C++ won't be difficult, especially since you can mix up compile units from the different languages in the same build. And even if Apple start being more restrictive, any compatibility problems that juce faces will be shared by a massive number of other developers, so people will find ways to handle it.

Interesting. So will you have to wrap a large chunk of the JUCE API in C or ObjC for this to work or is the surface area of JUCE exposed to the operating system not that large?


The surface area's pretty small and in a worst-case scenario it wouldn't be hard to rewrite the internal stuff as pure C. But I doubt very much whether that'll become necessary - Apple are going to be stuck with their obj-C system calls for many many years yet, I think!

Good to know. Thanks for responding!

Just linking in a new thread that picks up the conversation: