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
2
votes
1 answer

Can I bridge C inline functions to Swift?

If I put an inline function in a .h file, then include that in the bridging header, can I invoke it in Swift? (Answer: Yes) But will it still be inline when invoked in Swift?
user16217248
  • 3,119
  • 19
  • 19
  • 37
2
votes
1 answer

Linker error when using Swift ObservableObject from Objective-C

I am trying to use a Swift class from Objective-c (as I do for many other classes) with the following error. Undefined symbol: OBJC_CLASS$__TtC9FileCloud18BrowserCoordinator The issue seems to be that this particular class conforms to the Swift…
Rivera
  • 10,792
  • 3
  • 58
  • 102
2
votes
2 answers

How to make Swift class conform to Objective-C protocol, without exposing it to Objective-C?

I have a Swift class called LoginCoordinator that performs a "Sign In with Apple" request. In order respond to callbacks it conforms to the ASAuthorizationControllerDelegate. Because of this requirement, I also need to make this class a subclass of…
2
votes
0 answers

@objc override func insertReactSubview(_ subview: UIView!, at atIndex: Int) is not called iOS

@objc override func insertReactSubview(_ subview: UIView!, at atIndex: Int) I use the above method to pass UIView from reactnative to ios. But this method is not calling sometimes. Please help.
Fathima km
  • 2,539
  • 3
  • 18
  • 26
2
votes
2 answers

Create a Metal Window Wrapper using Objective-C++

I am currently developing a lightweight game engine in C++ however I am developing on a Mac. Originally, I was using Bootcamp however I wanted to try to implement it on Mac using premake. I want to implement some Metal support into my engine and I…
James51332
  • 164
  • 11
2
votes
0 answers

Not able to import "project-name-Swift.h" file xcode

I have 2 files. "CodeInjection.m" #import #import "BiplovCodeInjection-Swift.h" @interface CodeInjection: NSObject @end @implementation CodeInjection static void __attribute__((constructor)) initialize(void){ …
Biplov
  • 1,136
  • 1
  • 20
  • 44
2
votes
0 answers

Mixing Swift and Obj-C inside framework

How can I use non public swift classes if I have an Objective C framework, not app. For introducing swift code in a objective C project I follow this steps: Create swift file and not create a bridging header because using bridging headers with…
Radost
  • 845
  • 7
  • 11
2
votes
0 answers

Error invalid task Ditto trying to add Swift bridging header?

Ok Im just trying to add a Swift bridging header, and following tutorials added a Header file, entered nothing but my #import and went over to Build Settings in my plist to change the header path. I dragged the file into here so it would have the…
blue
  • 7,175
  • 16
  • 81
  • 179
2
votes
2 answers

Cannot access Objective-C singleton's array from Swift code

I made an array in a singleton to write objects into it from multiple parts of my code. Here's how: // in singleton.h #import // make globally accessible array @interface MyManager : NSObject { NSMutableArray…
SumakuTension
  • 542
  • 1
  • 9
  • 26
2
votes
1 answer

How to make a async call function on C++ using threads called from Swift code?

I'm trying make a simple async call using C++. My problem is that my code executing sync and use block functions. I want a async and non-blocking program. First time, I wrote a little code in C++ to test my logic, so the program ends before thread…
Augusto
  • 3,825
  • 9
  • 45
  • 93
2
votes
1 answer

Swift to C bridging: String to UnsafePointer? is not automatically bridged?

While trying to interface with a C library (Vulkan) I am faced with the following error while trying to assign a Swift(4.2) native String to C String error: cannot assign value of type 'String' to type 'UnsafePointer?' I'm doing a simple…
Leonardo Marques
  • 3,721
  • 7
  • 36
  • 50
2
votes
1 answer

Passing a file as a parameter to a C++ method from Swift

I am trying to call some C++ code in a Swift application. I did not write the C++ nor do I have control over it. I have created a C++ wrapper to handle the calls from Swift. I also added some test functions within the C++ files to verify that I am…
Pheepster
  • 6,045
  • 6
  • 41
  • 75
2
votes
1 answer

Swift - unrecognized selector sent to instance on SDWebImage methods on

I have added ful SDWebImage folder on my project. Also added a bridging header . My app don't create any problem during install but while i try to access SDWebImage methods it give the the following exception "unrecognized selector sent to instance"…
Md. Sulayman
  • 781
  • 8
  • 30
2
votes
1 answer

Removing bridging header steps

I am removing the "target-Bridging-Header.h" and also removing it from build settings SWIFT_OBJC_BRIDGING_HEADER (Objcetive-C Bridging Header) Do I need switch other flags to off (like Install Objective-C Compatibility Header or Precompile Bridging…
Durdu
  • 4,649
  • 2
  • 27
  • 47
2
votes
2 answers

Unable to access swift file from static library to application target

I have workspace contains subprojects and one of the subprojects generates static lib which contains both ObjC and swift which is linked to main application project. I am unable to access a swift class from a static library in ObjC file in…
V V
  • 774
  • 1
  • 9
  • 29