Skip to content

[cxx-interop] Add link to safe interop documentation #1085

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions documentation/cxx-interop/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -1335,6 +1335,16 @@ automatically.

## Working with C++ References and View Types in Swift

<div class="info" markdown="1">
Swift 6.2 introduces a new [safe interoperability](https://www.swift.org/documentation/cxx-interop/safe-interop)
mode, which makes it possible to use C/C++ pointers and specific view types,
such as `std::span`, safely from Swift. We recommend enabling safe
interoperability mode, since it provides stronger safety guarantees. The
features described in the following section can still be used in cases where the
safe interoperability features do not apply or are overly restrictive, e.g. for
APIs returning C++ references.
</div>

As outlined
[earlier](#member-functions-returning-references-are-unsafe-by-default),
member functions that return references, pointers, or certain structures/classes that
Expand Down