Value for SWIFT_VERSION cannot be empty

SwiftXcode10

Swift Problem Overview


I have installed swift pods for the obj c project. I got this error when I was trying to build it.

enter image description here

I have gone through all the solutions like deleting derived data, cleaning the build folder. Swift Compiler_Language also missing in the XCode 10. Added user-defined setting too, even it didn't work.

Swift Solutions


Solution 1 - Swift

Select your app target then goto build setting, search for swift set the swift language version from the dropdown.

enter image description here

Solution 2 - Swift

In case there is anybody else reading through this thread who has this same problem but was unable to solve it using the above answers, this may help:

If you have a data model, you need to check that when you click on the data model, click on an entity, and bring up the file inspector, the "Code Generation" Language is properly set. In my case my whole app was written Objective-C, but was set here to Swift for some reason. This is another reason that Error will show up in the Issue Navigator.

It's very important to clear the build folder after changing Code Generation Language. This can be done by pressing Command-Shift-K or by clicking Product->Clean Build Folder in the menu at the top of the screen.

Check out this link for a picture of where to find the "Code Generation" option I'm talking about.

Model.xcdatamodeld->File Inspector->Code Generation

Solution 3 - Swift

Update for Xcode 10.2

  1. Go to --> Build Setting

  2. Select All + Combined or All + Levels underneath the Build Settings

  3. And Finally on the search bar, on the right hand side search for "Swift Language Version"

as you see in the image worked for me

Solution 4 - Swift

You need to search for every "PRODUCT_NAME =" There needs to be a " SWIFT_VERSION = "4.2"; " after everyone. eg. also PRODUCT_NAME = "$(TARGET_NAME)";enter code here

Solution 5 - Swift

Still, after all of that, if you're still at lost, you can add a SWIFT_VERSION directly the project file:

		80B11AAAAAAAAAAAAAAAC3E5D8 /* Debug */ = {
		isa = XCBuildConfiguration;
		baseConfigurationReference = DF5...040;
		buildSettings = {
            ...
			PRODUCT_MODULE_NAME = react-native-some-module;
            ...
			SWIFT_VERSION = "4.2";
		};
		name = Debug;
	};

Repeat for both the Debug and Release targets. That had me hop over this issue.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionKumaraprasadView Question on Stackoverflow
Solution 1 - SwiftRatul SharkerView Answer on Stackoverflow
Solution 2 - SwiftBMPattersonView Answer on Stackoverflow
Solution 3 - SwiftShahriar Kabir KhanView Answer on Stackoverflow
Solution 4 - SwiftLeif-Göran RasmussonView Answer on Stackoverflow
Solution 5 - SwiftPatrice GagnonView Answer on Stackoverflow