C++ and Swift in Xcode 16 broke my audio unit

I'm developing an audio unit for use on iOS. The AUv3 worked fine with xcode 15.X and swift 5.X. I recently tried to submit an update to my plug-in but Apple refused submission because my Xcode was not the latest. Now that I'm on Xcode 16.4 I can't get my project to compile, even when following all of the same previous steps.

As one example of a change, Xcode doesn't appear to include the “C++ and Objective-C interoperability” build setting that it used to. This setting is noted in the Swift documentation and I used to need it, https://www.swift.org/documentation/cxx-interop/project-build-setup/#mixing-swift-and-c-using-xcode

Currently my C++ code can't see anything from Swift, and I get a "Use of undeclared identifier 'project_name'". I've selected Switch support for version 5.0 in an attempt to minimize changes from Apple.

My process is I generate an Xcode project file from my audio plugin support, JUCE. Then I add in the swift files, click yes to create bridging headers, but c++ doesn't see swift anymore. I'd greatly appreciate any suggestions.

Answered by rstoneba in 851815022

So I tried restarting from the backup of my last working version. I recompiled module Swift stuff and this time my main project was able to compile! Yay! (Of course right after I post here). I have no idea what is different about this older project file than a new one.

I of course tried to compile my project (the working version) with the new Xcode but I get a Module compiled with Swift 5.9.2 can't be imported by the Swift 6.1.2 compiler. Unfortunately re-compiling those modules in the new Xcode doesn't seem to help.

So I tried restarting from the backup of my last working version. I recompiled module Swift stuff and this time my main project was able to compile! Yay! (Of course right after I post here). I have no idea what is different about this older project file than a new one.

I’m glad to hear you got this sorted.

As to what the actual problem was, it’s hard to say without a reproducible case. It could’ve been something as simple as needing to a Product > Clean Build Folder, and reverting from a backup perturbed things enough that Xcode decided to do this by itself.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

C++ and Swift in Xcode 16 broke my audio unit
 
 
Q