Taking C++ interoperability through Swift evolution

Hi @cxx-interop-workgroup ,

Swift started supporting interoperability with C++ in Swift 5.9. We have gotten a significant amount of feedback both before and after Swift 5.9 got released, and we now think that we’re ready to start taking C++ interoperability through the Swift evolution process.

C++ interoperability is a large and complex language feature. As such, we can’t take the entire feature through the evolution process in one proposal. Because of that, we would like to take a piecewise approach to evolution of C++ interoperability. This way we can start by building on top of existing support for C / Objective-C interoperability, and subsequent evolution proposals can build on top of each other.

We put together a list of four initial proposals which we would like to take through evolution first:

  1. Using C++ classes and structures in Swift
  2. Using C++ methods and initializers in Swift
  3. Bridging Swift modules to C++ and Swift native functions to C
  4. Using sequential C++ containers in Swift

Let us know if you have any thoughts about this plan. I am planning to put out the initial version for the first proposal in the next two weeks.

27 Likes

Hello, fellows!

I could develop a first approach to proposal 4.

Let me know of initial possibilities, if they already exist.

1 Like

Hey!

We have initial support for working with containers, that's documented here:

We're planning to take this kind of approach through evolution. We would definitely love to hear specific ideas that you have for how to approach this problem for proposal 4.