how to use cpp with swift
Asked on 06/15/2025
1 search
To use C++ with Swift, you can refer to the session titled "Safely mix C, C++, and Swift" from WWDC 2025. This session provides guidance on how to ensure safety when calling C and C++ code from Swift. It covers topics such as finding unsafe calls in Swift, calling C/C++ safely, and improving the safety of C/C++ code.
For a detailed explanation on how to safely mix these languages, you can start by watching the session from the beginning. Here's the link to the session: Safely mix C, C++, and Swift.
If you are interested in specific topics like finding unsafe calls or calling C/C++ safely, you can jump to the relevant chapters in the session:
These resources should help you understand how to integrate C++ with Swift effectively and safely.

Safely mix C, C++, and Swift
Learn how to mix C, C++, and Swift while improving the safety of your apps. We’ll show you how to find where unsafe C and C++ APIs are called in your Swift code, how to call them more safely, and how to make your app’s existing C and C++ code safer by default.

What’s new in Swift
Join us for an update on Swift. We’ll briefly go through a history of Swift over the past decade, and show you how the community has grown through workgroups, expanded the package ecosystem, and increased platform support. We’ll introduce you to a new language mode that achieves data-race safety by default, and a language subset that lets you run Swift on highly constrained systems. We’ll also explore some language updates including noncopyable types, typed throws, and improved C++ interoperability.

Explore Swift and Java interoperability
Learn how you can mix Swift and Java in a single codebase. We’ll introduce the swift-java interoperability project, which allows you to use Swift in Java programs or vice versa. We’ll show you how to use the tools and libraries offered by swift-java to write safe and performant code that interoperates between these two runtimes.