Library from swift (CInterop) doesn't compile with Xcode 13

We have a project that uses Cinterop to call swift code in a static library from Kotlin.It was doing fine with Xcode 12.5, but when we try to compile it with Xcode 13 we get the error:

Exception in thread “main” java.lang.Error: /Applications/ error: function does not return NSString

Which is obviously a line that Apple changed in the libraries. We tried a bunch of approach to fix this but nothing worked.

Our project use the mechanism described in:

and the code for this can be found at
GitHub - KodeinKoders/playground-SwiftLib-in-KMMLib

This code has exactly the same error as ours. Is there anything we can do. Or is it something that will require changes in the Multiplatform plugin

I have exactly the same issue :frowning:

Although all my cinteropXYZ gradle tasks failed with a less meaningful error message, I can confirm, that the cinterop tasks break with the update to xcode13. After ~2 days of debugging and ruling out other possibilities (I work on a m1 mac), I found myself installing Xcode 12.5 from the apple developer page.
As soon as Xcode 12.5 and 13 are both installed, you can choose the used xcode command line tools in the xcode preferences (under “Locations”). With “Xcode 12.5.1” selected, all my cinterop tasks run flawlessly again. As the Update to Xcode13 also updated the bundled Apple Clang Compiler, my guess is, that a change in clang is the root of the cinterop issue.

Finally found a solution in a post on slack. Add this to your cinterop task

extraOpts = listOf("-compiler-option", “-DNS_FORMAT_ARGUMENT(A)=”)