ios – XCode 14.0.1 randomly switches between generating Swift and Objective-C bindings for mlmodel file


XCode seems to use some kind of heuristic when choosing whether to make an “Automatically generated Objective-C model class” or an “Automatically generated Swift model class”. For me, just running “rm -rf Pods” and then “pod install” to add a new react-native component was enough to flip this heuristic. This has happened two times for me now, and each time XCode changes its mind, I have to add/remove Swift/Objective-C bridging headers, since I am using these models from Swift, and change the labels to fit the slightly different API, just to get the project to build again. I do also have some Objective-C in the project needed to interface with C++, which is probably part of the problem.

Is there any way I can force XCode to generate Swift model classes? Or at least guarantee a reproducible build either way?