# \#bridging

**URL:** https://forums.swift.org/tag/bridging/46.md

[Latest](https://forums.swift.org/latest.md) · [Categories](https://forums.swift.org/categories.md) · [Tags](https://forums.swift.org/tags.md)

---

## [Dev writeups of the Swift SDK for Android](https://forums.swift.org/t/dev-writeups-of-the-swift-sdk-for-android/89711)

<div class="topic-metadata">

**Author:** [@Finagolfin](https://forums.swift.org/u/Finagolfin)\
**Replies:** 3\
**Last updated:** [October 16, 2026, 2:45pm UTC](https://forums.swift.org/t/dev-writeups-of-the-swift-sdk-for-android/89711 "2026-10-16T14:45:03Z")

</div>

After the first release of the official Swift 6.3 SDK for Android in March, some devs wrote up their experiences this summer, which can be a useful guide for other devs and feedback for the Android and Swift workgroups (…

---

## [Shipping C/C++ headers in the Swift toolchain](https://forums.swift.org/t/shipping-c-c-headers-in-the-swift-toolchain/81496)

<div class="topic-metadata">

**Author:** [@j-hui](https://forums.swift.org/u/j-hui)\
**Replies:** 13\
**Last updated:** [May 7, 2026, 12:24am UTC](https://forums.swift.org/t/shipping-c-c-headers-in-the-swift-toolchain/81496 "2026-05-07T00:24:18Z")

</div>

The swift/bridging header defines C/C++ annotations that are recognized and used by Swift's ClangImporter for interop. This header file currently ships with the toolchain in the \<toolchain\>/usr/include/ subdirectory, whi…

---

## [VSCode: Bridging headers with Intellisense in simple Embedded Project](https://forums.swift.org/t/vscode-bridging-headers-with-intellisense-in-simple-embedded-project/78470)

<div class="topic-metadata">

**Author:** [@MisutaaAsriel](https://forums.swift.org/u/MisutaaAsriel)\
**Replies:** 2\
**Last updated:** [March 13, 2025, 2:17pm UTC](https://forums.swift.org/t/vscode-bridging-headers-with-intellisense-in-simple-embedded-project/78470 "2025-03-13T14:17:06Z")

</div>

Hey, I'm wanting to experiment with Embedded Swift, and the device I am targeting uses an SDK that relies on makefiles. Basing my project structure off a similar project using Embedded Swift, on a similar platform, which…

---

## [How to convert C++ std::u8string to String?](https://forums.swift.org/t/how-to-convert-c-std-u8string-to-string/76245)

<div class="topic-metadata">

**Author:** [@ola](https://forums.swift.org/u/ola)\
**Replies:** 0\
**Last updated:** [November 27, 2024, 3:07pm UTC](https://forums.swift.org/t/how-to-convert-c-std-u8string-to-string/76245 "2024-11-27T15:07:48Z")

</div>

The Swift String class does not seem to accept std.u8string (CxxStdlib), only std.string? I'd rather not do a interpret\_cast on the C++ side, is there a clean way to do this on the Swift side (using the C++ interop)?

---

## [Importing Objective-C framework in a Swift Framework](https://forums.swift.org/t/importing-objective-c-framework-in-a-swift-framework/73168)

<div class="topic-metadata">

**Author:** [@ibrahimdh2](https://forums.swift.org/u/ibrahimdh2)\
**Replies:** 4\
**Last updated:** [July 30, 2024, 3:04pm UTC](https://forums.swift.org/t/importing-objective-c-framework-in-a-swift-framework/73168 "2024-07-30T15:04:07Z")

</div>

Hi, I am trying to make a Swift framework that uses an Objective-C framework. But it doesn't work it says that "Could not build objective C module". Since it is a framework bridging header doesn't work. The official app…

---

## [Automatic module name variable](https://forums.swift.org/t/automatic-module-name-variable/65573)

<div class="topic-metadata">

**Author:** [@tera](https://forums.swift.org/u/tera)\
**Replies:** 0\
**Last updated:** [June 14, 2023, 4:47pm UTC](https://forums.swift.org/t/automatic-module-name-variable/65573 "2023-06-14T16:47:58Z")

</div>

Any way to automate this: // BridgingHeader.h #import "ProductName-Swift.h" // should be module name here wanted something like this: // BridgingHeader.h #import "$(PRODUCT\_NAME)-Swift.h" Or, maybe there's a way to g…

---

## [Why SPM library with Objective-C NSURL category is not available in Swift URL type?](https://forums.swift.org/t/why-spm-library-with-objective-c-nsurl-category-is-not-available-in-swift-url-type/65005)

<div class="topic-metadata">

**Author:** [@nacho4d](https://forums.swift.org/u/nacho4d)\
**Replies:** 3\
**Last updated:** [June 14, 2023, 12:02am UTC](https://forums.swift.org/t/why-spm-library-with-objective-c-nsurl-category-is-not-available-in-swift-url-type/65005 "2023-06-14T00:02:35Z")

</div>

I asked the same question in Stackoverflow and no luck yet. So I post it here hoping my luck to change. I created an SPM small. library with some Objective-C code. Some code is a category on NSURL class. @interface NSU…

---

## [String indices validity](https://forums.swift.org/t/string-indices-validity/63950)

<div class="topic-metadata">

**Author:** [@stuchlej](https://forums.swift.org/u/stuchlej)\
**Replies:** 18\
**Last updated:** [March 27, 2023, 11:57am UTC](https://forums.swift.org/t/string-indices-validity/63950 "2023-03-27T11:57:51Z")

</div>

It's 6pm on friday in my place, so it's runtime crashes on production time. Yeeey! The issue is following: class Label: UILabel { ... public var stylableText: String? { // get { super.attributedText?.string.cSt…

---

## [How to bridge a nasty C function (with complications)](https://forums.swift.org/t/how-to-bridge-a-nasty-c-function-with-complications/60948)

<div class="topic-metadata">

**Author:** [@Gavin\_Eadie](https://forums.swift.org/u/Gavin_Eadie)\
**Replies:** 14\
**Last updated:** [January 21, 2023, 12:16am UTC](https://forums.swift.org/t/how-to-bridge-a-nasty-c-function-with-complications/60948 "2023-01-21T00:16:38Z")

</div>

Context: I'm trying to call a complicated C function from Swift. The function is part of the unit testing of a C library (hence the motley crew of parameters). The library is only available as a dylib so I can't touch…

---

## [The peculiar case of NSString bridged strings](https://forums.swift.org/t/the-peculiar-case-of-nsstring-bridged-strings/59774)

<div class="topic-metadata">

**Author:** [@tera](https://forums.swift.org/u/tera)\
**Replies:** 1\
**Last updated:** [August 20, 2022, 2:03am UTC](https://forums.swift.org/t/the-peculiar-case-of-nsstring-bridged-strings/59774 "2022-08-20T02:03:27Z")

</div>

Found an interesting peculiarity in Strings bridged from NSString. In the following fragment I run the app and use the same string for string2 variable as the string1 obtained from the stringsdict file: let string1:…

---

## [Xcframework with swift+objectiveC + C++](https://forums.swift.org/t/xcframework-with-swift-objectivec-c/58818)

<div class="topic-metadata">

**Author:** [@AlexMemomi](https://forums.swift.org/u/AlexMemomi)\
**Replies:** 0\
**Last updated:** [July 10, 2022, 10:46am UTC](https://forums.swift.org/t/xcframework-with-swift-objectivec-c/58818 "2022-07-10T10:46:26Z")

</div>

Hi. We have a C++ cross-platform based project. It is designed as library with public API. We trying to warp it with some swift interface in order to make some standalone IOS module to distribute it to some other guys wh…

---

## [About Implicit ObjC Bridging & CVarArg](https://forums.swift.org/t/about-implicit-objc-bridging-cvararg/57662)

<div class="topic-metadata">

**Author:** [@lhunath](https://forums.swift.org/u/lhunath)\
**Replies:** 3\
**Last updated:** [May 29, 2022, 2:04pm UTC](https://forums.swift.org/t/about-implicit-objc-bridging-cvararg/57662 "2022-05-29T14:04:15Z")

</div>

I'm trying to better understand Swift - ObjC bridging and in particular its implicit behaviours & its peculiarities regarding C interop (such as CVarArg). All of these things appear to be poorly documented (but please co…

---

## [Help~ NSMutableArray conditional bridge crash in iOS 15.4 beta](https://forums.swift.org/t/help-nsmutablearray-conditional-bridge-crash-in-ios-15-4-beta/55197)

<div class="topic-metadata">

**Author:** [@beforeold](https://forums.swift.org/u/beforeold)\
**Replies:** 6\
**Last updated:** [February 14, 2022, 7:38am UTC](https://forums.swift.org/t/help-nsmutablearray-conditional-bridge-crash-in-ios-15-4-beta/55197 "2022-02-14T07:38:50Z")

</div>

We found our app crashes in iOS 15.4 beta only. The summary: Try to conditionally cast to swift array from an Objective-C NSMutableArray property of Objective-C class The NSMutableArray property is declared nonnull by …

---

## [URLComponents(url:) is much faster than URLComponents(string:) - possible bridging performance issue?](https://forums.swift.org/t/urlcomponents-url-is-much-faster-than-urlcomponents-string-possible-bridging-performance-issue/54507)

<div class="topic-metadata">

**Author:** [@Karl](https://forums.swift.org/u/Karl)\
**Replies:** 6\
**Last updated:** [January 8, 2022, 4:19am UTC](https://forums.swift.org/t/urlcomponents-url-is-much-faster-than-urlcomponents-string-possible-bridging-performance-issue/54507 "2022-01-08T04:19:51Z")

</div>

I've noticed a rather strange performance difference between URLComponents(url:resolvingAgainstBaseUrl:) and URLComponents(string:) - namely that the former seems a fair bit faster than the latter. This is on a macOS 11.…

---

## [What is the ObjC counterpart for \_ObjectiveCBridgeable?](https://forums.swift.org/t/what-is-the-objc-counterpart-for-objectivecbridgeable/39580)

<div class="topic-metadata">

**Author:** [@Nickolas\_Pohilets](https://forums.swift.org/u/Nickolas_Pohilets)\
**Replies:** 1\
**Last updated:** [August 21, 2020, 4:27pm UTC](https://forums.swift.org/t/what-is-the-objc-counterpart-for-objectivecbridgeable/39580 "2020-08-21T16:27:14Z")

</div>

I'm trying to implement a transparent ObjC\<-\>Swift bridging for my custom type. I've conformed Swift type to \_ObjectiveCBridgeable, and when imported into ObjC, all usages of it are automatically bridged. But when bridg…

---

## [Swift fail to detect constant in Macro from C header](https://forums.swift.org/t/swift-fail-to-detect-constant-in-macro-from-c-header/39193)

<div class="topic-metadata">

**Author:** [@kwc](https://forums.swift.org/u/kwc)\
**Replies:** 2\
**Last updated:** [August 8, 2020, 5:35am UTC](https://forums.swift.org/t/swift-fail-to-detect-constant-in-macro-from-c-header/39193 "2020-08-08T05:35:00Z")

</div>

In my C header, I have macro to define some constants: typedef struct ion\_type \*ION\_TYPE; #define ION\_TYPE\_INT(x) ((intptr\_t) (x)) #define tid\_BOOL ((ION\_TYPE) tid\_BOOL\_INT) #define tid\_INT ((ION\_…

---

## [ObjC parent class with forward declaration in designated initializer has no accessible initializers](https://forums.swift.org/t/objc-parent-class-with-forward-declaration-in-designated-initializer-has-no-accessible-initializers/11779)

<div class="topic-metadata">

**Author:** [@Ashton](https://forums.swift.org/u/Ashton)\
**Replies:** 1\
**Last updated:** [April 23, 2020, 5:37am UTC](https://forums.swift.org/t/objc-parent-class-with-forward-declaration-in-designated-initializer-has-no-accessible-initializers/11779 "2020-04-23T05:37:33Z")

</div>

This is a behaviour that has changed between Swift 3 and Swift 4. I don't know if this is a bug, or improved correctness. Before I submit a bug I wanted some feedback. Example 1 Given this Objective-C header of a class…

---

## [Uninitialised nonnull properties of Foundation types are set to sensible defaults in Swift](https://forums.swift.org/t/uninitialised-nonnull-properties-of-foundation-types-are-set-to-sensible-defaults-in-swift/20323)

<div class="topic-metadata">

**Author:** [@elitalon](https://forums.swift.org/u/elitalon)\
**Replies:** 8\
**Last updated:** [March 7, 2019, 7:13am UTC](https://forums.swift.org/t/uninitialised-nonnull-properties-of-foundation-types-are-set-to-sensible-defaults-in-swift/20323 "2019-03-07T07:13:55Z")

</div>

Hello everyone, I was writing a unit test in Swift for a class written in Objective-C when I came across the following behaviour: nonnull properties of some Foundation types (e.g. NSString or NSArray) declared in a Obje…

---

## [Bridging ObjC Categories on Types with Struct Swift Overlay](https://forums.swift.org/t/bridging-objc-categories-on-types-with-struct-swift-overlay/11382)

<div class="topic-metadata">

**Author:** [@fabb](https://forums.swift.org/u/fabb)\
**Replies:** 5\
**Last updated:** [March 26, 2018, 5:43pm UTC](https://forums.swift.org/t/bridging-objc-categories-on-types-with-struct-swift-overlay/11382 "2018-03-26T17:43:37Z")

</div>

I have a bridged projects with ObjC categories on types like NSURL or NSError. Swift does not see the category methods on the overlay structs (URL, Error), The only way to I found to work around this is by casting to the…
