JonahGabriel JonahGabriel - 8 months ago 32
Swift Question

No Swift settings in XCode 5 project

So I am trying to add some Swift code to an existing project created in XCode 5 and I get a crash whenever I try to automatically generate a bridging header. Looking in my project settings, I think it is because there are no Swift Compiler settings. Anyone know of a way to migrate a project to XCode 6 settings or do I need to re-create the project?


The only solution I've found for this is to create a new target. Make sure to select "Swift" as the language choice for the new target. Something in the creation of a target with this selection enables the Swift build settings.

Update: Creating a new target containing Swift worked because of what it contained. When I removed the template Swift files from the new target the Swift-specific build settings disappeared from the project again.

The real indicator to Xcode on whether to show those build settings is whether the target contains at least one .swift file. So, the easiest solution is to simply add a new Swift file. This also triggers Xcode to prompt you about automatically creating an Objective-C bridging header - which you'll need in any project that has some Objective-C in it.