Questions tagged [bridging-header]

Special header that facilitates cross-language developments between Swift, Objective-C, Objective C++, C and C++ on MacOS and iOS. Use exclusively cross-language development.

The bridging header is a special header in MacOS and iOS projects that aims at facilitating multi-language development by sharing definitions that are common between Swift and Objective C code.

In view of the (limited) interoperability between Objective-C and other programming languages, the bridging header also facilitates Objective-C++, C and C++ interoperability.

External references:

350 questions
6
votes
1 answer

Using cocoapods without use_frameworks! in Swift

According to this tutorial, we should add use_frameworks! to Podfile in Swift project. But how to use third-party code in .m in the same project? One possible way is, Do NOT add use_frameworks! to Podfile Import header in…
Yuwen Yan
  • 4,777
  • 10
  • 33
  • 63
6
votes
5 answers

Bridging Header issue - 'MyClass' is unavailable: cannot find Swift declaration for this class

I have visited this links - MyClass is unavailable: cannot find Swift declaration for this class - Release Build Only Adding Linked or Embedded Swift Framework: 'MyClass' is unavailable: cannot find Swift declaration for this class Swift: using…
Rajat
  • 10,977
  • 3
  • 38
  • 55
6
votes
1 answer

How to add a Bridging-Header to Xcode Playground?

Is it possible to include ObjectiveC header files using a Bridging-Header file to Xcode Playground?
Michael
  • 32,527
  • 49
  • 210
  • 370
5
votes
3 answers

How to set up interoperability between internal Swift and Objective-C classes when developing a Framework

I have a Framework with mixed Objective-C and Swift classes and i'd like to communicate between them keeping the Swift interface internal (without making Swift classes and methods public). Is there a way to achieve that? P.S. Please pay attention…
muzzammil
  • 61
  • 1
5
votes
0 answers

@testable import and Bridging header don't work simultaneously

I have Test target for my framework project which include: Obj-C tests Swift tests with @testable import to test internal classes and functions Some utils written in Obj-C for my tests which should be used in both 1) and 2) Since I want to use…
user3237732
  • 1,976
  • 2
  • 21
  • 28
5
votes
2 answers

Access C++ Enum from Swift

I am trying to access enum's values written in C++ header from Swift. Specifically, I have this enum in OpenCV's hpp header file that I would like to expose its values to Swift. I have attempted to set up a bridging header between Swift and…
HuaTham
  • 7,486
  • 5
  • 31
  • 50
5
votes
1 answer

swift: Xcode Couldn't Generate Swift Representation for Facebook framework

I am try to integrate facebook in my app using Swift. I have download the Facebook SDK in my app. the fecebook SDK is in Objective-C. And for that to connect Objective-C files in Swift I am creating an Bridging-Header.h file and import the…
Pallavi Nikumbh
  • 298
  • 4
  • 19
5
votes
2 answers

Bridging Header for Flurry.h not working with Pod

I have an existing bridging header that currently contains several obj-c pods. I am having issue importing the Flurry framework with Xcode saying 'Flurry.h' file not found even though it has been correctly inserted using pods. My bridging header…
Allreadyhome
  • 1,252
  • 2
  • 25
  • 46
5
votes
4 answers

Failed to Import Bridging Header Error

I accidentally messed up my projects' settings while installing and then uninstalling cocoapods. I'm now getting the error "failed to import bridging header". I checked my build settings and the path to the file under build settings > code…
xyz123
  • 191
  • 1
  • 3
  • 6
4
votes
1 answer

Flutter - Swift Compiler Error (Xcode): Using bridging headers with module interfaces is unsupported

I have a flutter project. I am struggle to build IPA flutter build ipa due to: Swift Compiler Error (Xcode): Using bridging headers with module interfaces is unsupported. Uncategorized (Xcode): Command SwiftDriver emitted errors but did not return…
Chris
  • 839
  • 1
  • 12
  • 30
4
votes
2 answers

Xcode 10, 11 - failed to emit precompiled header

I have taken a project from another laptop to mine. In the other mac it works without any issues but in mine, I am getting this issue - failed to emit precompiled header …
Aditya Ahuja
  • 316
  • 3
  • 17
4
votes
0 answers

Prevent Swift files from being exposed to the Objective-C Generated Interface Header

Is it possible to explicitly declare that a Swift source file isn't included in the Objective-C Generated Interface Header? As an example, let's say I have this Swift class class MyViewController: UIViewController { } In my MyApp-Swift.h generated…
bclymer
  • 6,679
  • 2
  • 27
  • 36
4
votes
0 answers

Xcode framework: Swift Generated Interface not in DerivedSources folder

Xcode 10, iOS 12 I have a project, that has 2 targets: an app and a framework. I use both Swift and Objective-C. I'm trying to reference Swift classes from Objective-C. I've set the SWIFT_OBJC_INTERFACE_HEADER_NAME property to "SwiftInterface.h" in…
Battlechicken
  • 308
  • 2
  • 6
4
votes
1 answer

Swift bridging header not exporting React Native types

I'm trying to create a native (iOS) module for a React Native app using Swift. I want to expose a method on the module that returns a promise, using functions of type RCTPromiseResolveBlock and RCTPromiseRejectBlock, both of which are declared in…
Karl L.
  • 41
  • 1
  • 2
4
votes
1 answer

XCTest | lexical or preprocessor issue: MyProject-Swift.h not found

My project uses for both Objective C and Swift (primarily Objcective C). Importing HomeViewController.h in a test class, HomeViewController imports MyProject-Swift.h to access the swift files. The build fails whenever I run the tests. The main…
1 2
3
23 24