Xcode 9.2 Is Not Showing Swift 4.1

Xcode 9.2 is not showing Swift 4.1

Apple documentation was incorrect, Swift documentation is correct.

Well, to be double sure of which version is supported, we'll test it:

  1. Set your command-line tools to xcode 9.2 (9C40b). It will switch to Xcode default swift version.

    sudo xcode-select --switch /Applications/Xcode.app
  2. Test your swift version.

    swift --version

Result is:

Apple Swift version 4.0.3 (swiftlang-900.0.74.1 clang-900.0.39.2)

In conclusion, it's really an Apple documentation issue:

Swift 4.1 is only natively available using Xcode 9.3+



Update: 3 months later

With the release of Xcode 10 on June 4th 2018, Apple documentation was finally correctly updated, stating that Swift 4.2 is available using Xcode 10.0+.

Is it possible to use Swift 4.0 (4.0.3) with XCode 9.3?

It's not possible.

But you can have two different Xcode versions in the Applications folder, just rename one of them.

Generic Decodable stopped working with swift 4.1

I don't get any errors. Please post it. As an exercise I added CustomStringConvertible conformance and replaced dump with print.

extension Response: CustomStringConvertible {
public var description: String {
return "data = \(data) | meta = \(meta)"
}
}

extension MyObject: CustomStringConvertible {
public var description: String {
return "date = \(creationDate)"
}
}

I am using Xcode 9.3, Swift 4.1 version 9E145 released through the App Store.

Sample Image

Module compiled with Swift 4.0 cannot be imported in Swift 4.0.1

Update:

For release versions of Xcode:

This error (and similar errors involving Swift 4.1, 4.2, etc.) will occur when opening a project with Xcode 9.1, 9.2, 9.3, 9.4, 10, etc. that uses frameworks that were built with earlier Xcode tools.

To fix the issue, update and rebuild your frameworks using Carthage ( carthage update --platform iOS), Cocoapods (pod update or pod install), or manually, with the new updated Xcode tools. The tools should be updated automatically when you update Xcode, but if not, you can follow the steps outlined below in the original answer.

You may also need to clean your project cmd + shift + k and possibly your build folder cmd + option + shift + k to get Xcode to not use cached framework builds.

In some cases you may also need to delete your derived data folder (Easily found by going to Xcode Preferences -> Locations -> Derived Data Folder
(Thanks Stunner)

For beta versions of Xcode:

See original answer below and then follow steps above.

Original Answer:

You probably still have your xcodebuild tools set to Xcode 9.0 which builds with Swift 4.0 and is incompatible with Xcode 9.1 beta's Swift 4.0.1.

Check in the terminal using the command:

xcodebuild -version

Or just go into Xcode preferences -> Locations and check/change the command line tools to Xcode 9.1. You should be set then.

Inconsistencies error in storyboard with xcode 9.2

You just simple need to follow to steps.

1. Take the folder Fonts which you have added in your project
2. Open MAC Font Book and drag the Fonts folder in Font book.
3. Close the project -> Clean and Build

This will solve your error.


Related Topics



Leave a reply



Submit