Swift 5.4 released!

Swift 5.4 has been released:

https://swift.org/blog/swift-5-4-released/

Thank you to everyone in the community who contributed in large and small ways to bring this release together!

40 Likes

Great news, but I have a question. Xcode release notes still have this known issue in them, however IIRC a fix for this was cherry picked into 5.4 long time ago. So what's the deal now?

The compiler may generate incorrect code when you use an enum case with associated values to satisfy a protocol requirement. (72302307) For example:

protocol FileHandlerAction {  
  static func setFileURL(_ fileURL: NSURL) -> Self
}
enum AppAction : FileHandlerAction {  
  case setFileURL(NSURL )
}

Workaround : Provide a static method to satisfy the requirement:

enum AppAction : FileHandlerAction {  
  case _setFileURL(NSURL)
  static func setFileURL(_ fileURL: NSURL) -> Self { 
    return ._setFileURL(fileURL)  
  }
}

cc @Joe_Groff

1 Like

When debugging Swift code on Apple platforms, variables with resilient types (including Foundation value types such as URL , URLComponents , Notification , IndexPath , Decimal , Data , Date , Global , Measurement , and UUID ) are displayed in the Xcode variable view and the frame variable / v command again.

Been waiting for this.

2 Likes

This was a clerical error in the release notes. The issues has indeed been fixed in 5.4.

3 Likes

Gorloff has his Android toolchain up to date with 5.4. Wev've been using his stuff for quite a while and it works great !

6 Likes

I just noticed that this is the first release to ship with a portion of the compiler written in Swift, the new Swift driver, albeit disabled by default. I'm able to use it with the official CentOS 8 build by adding this environment variable:

> SWIFT_USE_NEW_DRIVER=swift-driver ./swift-5.4.1-RELEASE-centos8/usr/bin/swift --version
<unknown>:0: remark: new Swift driver at '/home/butta/swift-5.4.1-RELEASE-centos8/usr/bin/swift-driver' will be used
Swift version 5.4.1 (swift-5.4.1-RELEASE)
Target: x86_64-unknown-linux-gnu

Congratulations to the Swift team, particularly @ArtemC for getting this merged, for getting a portion of the compiler rewritten in Swift, looking forward to more in the future. I see that the official Swift 5.5 snapshots use the new Swift driver by default.

5 Likes

They also mentioned it in WWDC 21: