Recently the Swift community released an announcement that in order to further provide interoperability support between Swift and C++, they formed the Swift and C++ Interoperability Working Group as part of the Swift project. The role of this new working group is to develop and design an interoperability model between C++ and Swift developed by Apple.

sobyte

In the announcement, Swift developer Alex Lorenz said that the reason for the Swift and C++ Working Group is that there is already significant developer interest in bi-directional interoperability between the two languages. So the working group will provide a framework to refine the goals and design of the interoperability layer and explore options for modifying the Swift compiler to support bidirectional interoperability between the two languages.

Details of the work of the working group:

  • This working group is responsible for developing and designing an interoperability model between C++ and Swift
  • The working group will meet once a week via video
  • The working group will initially focus on how to rapidly iterate on the interoperability model between the two languages
  • The working group is complementary to the existing Swift development process. The working group will first design the interoperability model and then bring it back to the Swift community for formal evaluation and discussion.

Swift Forum:

The “Development” section of the forum will have a new “C++ Interoperability” sub-section, which is open to all and will host technical discussion threads related to C++ interoperability. In addition to technical discussions, it will also include minutes of working group meetings.

With contributions from developers like zoecarver, egor.zhdan, gribozavr, and Michael Forster, the Swift compiler is now able to import and use some C++ APIs, including C++ standard library types like std::string and std::vector. . Interoperability between the two is expected to be further enhanced with the formation of the working group.

In addition to the existing members of the working group, other developers interested in this project can participate, including

  • making code changes in the interoperability layer of the Swift compiler
  • Writing user-oriented documentation for this feature
  • Reviewing relevant PRs and/or proposals
  • Providing design input for mapping specific code patterns between the two languages

However, any proposed changes must be consistent with the goals and philosophy of Swift, and creating branches of the Swift language or standard library, as well as creating a dialect without branches, is not an option for them.

Interested developers can check out the “C++ Interoperability Documentation” posted on the Swift GitHub page, which describes in detail which details the goals and design of bi-directional API interoperability between Swift and C++.