Xcode 8.3 Swift Version Error (Swift_Version) in Objective C Project

Xcode 8.3 Swift Version Error (SWIFT_VERSION) In Objective C Project

So the answer to this is to go to the build settings and click the + icon at the top left (as per screen shot below). Then choose to add a User Defined parameter with SWIFT_VERSION and a value of 3.0. Build the app and it should run fine.

Sample Image

I also added the following to my Pod file too to automatically do the same process for the pod dependency build settings, although this alone did not resolve the problem:

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end

Xcode 8 Beta 3 Use Legacy Swift issue

I have been ignoring this problem for a while now and just working on other stuff in the meantime - I finally found the solution to my problem.

Since my project is Objective-C I figured maybe one of the Pods I am using was using Swift, I checked each Pod and none of them were.

The final solution was that my Core Data model was set to generate code in Swift even though I have been manually generating them in the File > New > NSManagedObjectSubclass menu. All I had to do was switch it to Objective-C.

screenshot

Xcode 9 Swift Language Version (SWIFT_VERSION)

Answer to your question:
You can download Xcode 8.x from Apple Download Portal or Download Xcode 8.3.3 (or see: Where to download older version of Xcode), if you've premium developer account (apple id). You can install & work with both Xcode 9 and Xcode 8.x in single (mac) system. (Make sure you've Command Line Tools supporting both version of Xcode, to work with terminal (see: How to install 'Command Line Tool'))


Hint: How to migrate your code Xcode 9 compatible Swift versions (Swift 3.2 or 4)
Xcode 9 allows conversion/migration from Swift 3.0 to Swift 3.2/4.0 only. So if current version of Swift language of your project is below 3.0 then you must migrate your code in Swift 3 compatible version Using Xcode 8.x.

This is common error message that Xcode 9 shows if it identifies Swift language below 3.0, during migration.

Sample Image


Swift 3.2 is supported by Xcode 9 & Xcode 8 both.

Project ► (Select Your Project Target) ► Build Settings ► (Type 'swift' in Searchbar) Swift Compiler Language ► Swift Language Version ► Click on Language list to open it.

Sample Image


Convert your source code from Swift 2.0 to 3.2 using Xcode 8 and then continue with Xcode 9 (Swift 3.2 or 4).


For easier migration of your code, follow these steps: (it will help you to convert into latest version of swift supported by your Xcode Tool)

Xcode: Menus: Edit ▶ Covert ▶ To Current Swift Syntax

Sample Image

“Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift

In the navigator selection bar, click the magnifying glass, then search for "SWIFT_VERSION" You will find the places in the project where you can adjust the swift version accordingly.

Sample Image

Sample Image

Xcode 8.3 can't support Swift 2.3

It is said in release note clearly that Xcode 8.3 doesn't support swift 2.x any more. You can either choose to use wizard to update your code to swift 3.1, or go back to Xcode 8.2.1.

https://developer.apple.com/library/content/releasenotes/DeveloperTools/RN-Xcode/Chapters/Introduction.html

Swift Language Version' option is missing in Xcode 9.1 Build Setting

You appear to have an Objective-C project rather than a Swift project. Objective-C projects do not have a Swift Language Version setting as a default.

You can add Swift Language Version as a User-Defined Setting, as described here.

Build time is too long in Xcode 8.3 with swift 3 in particular file

I tried debugging your issue. This is what I found out:

if let pdfData = data as? CFData {

}

The above line for casting object of type Data to CFData is where it's taking too much time to build.

Replacing that with the following piece of code significantly reduces your build time.

let pdfNsData: NSData = NSData(data: data) // convert `Data` to `NSData`

if let cfPdfData: CFData = pdfNsData as? CFData {
// cast `NSData` to `CFData`

}

NSData and CFData are toll-free bridged.

Please let me know if there's any doubt

Use Legacy Swift Language Version - Xcode 8.2

Found work around. I went through each target (and project settings, so both in the project and target) in my project, toggled the "Use Legacy Swift Language Version" from "No" to "Yes" and back to "No" for each. The project then built again.

Sample Image

why doesn't Xcode 8.3.2 show immediate syntax error while editing

There are two places in Xcode's settings that control this behavior: a global setting for the editor, and another setting for each project.

For the global setting, go to the menubar and choose Xcode -> Preferences.... Click the tab for General, then make sure the box for Show live issues is checked.Xcode general preferences

For the project settings, with your project open go to File -> Project Settings... then check the box next to Show live issues for source code.

Xcode project settings



Related Topics



Leave a reply



Submit