Xcode 26 swiftmodules are incompatible with Xcode 16

I am developing a binary SDK for consumption by others. When we updated to Xcode 26, any builds which are generated cannot be consumed by Xcode 16.

The specifics lie in the optionals. The following Swift code generate a .swiftmodule

func affectedApi() -> Int? { return 1 } 

In Xcode 16 it generated the following .swiftmodule in the framework.

public func affectedIntApi() -> Swift.Int?

In Xcode 26 it adds an "if" statement.

  #if compiler(>=5.3) && $NonescapableTypes
  public func affectedIntApi() -> Swift.Int?
  #endif

That if statement prevents Xcode16 from seeing the API, and it causes compile failures. This happens regardless of which Swift version is used, and it only affects functions which use Optionals.

Is there a way to prevent the compiler from wrapping the API in that statement?

My assumption is that this is related to the new NonescapableTypes proposal in Swift 6.3: https://github.com/swiftlang/swift-evolution/blob/main/proposals/0446-non-escapable.md

But why does it affect previous versions of swift too?

You should read through the details of Library Evolution and how Swift handles that. Further, if you're not building as an XCFramework to create the textual library interface, instead of the binary module interface, you should do so.

— Ed Ford,  DTS Engineer

Xcode 26 swiftmodules are incompatible with Xcode 16
 
 
Q