Questions tagged [objective-c-swift-bridge]

Swift’s compatibility with C and Objective-C lets you create a project that contains files written in either language.

Official documentation.

117 questions
2
votes
0 answers

Swift Class in objective C

I have settings.swift and i am importing -Swift.h into my ObjC class .m file. I need something like : @property(nonatomic, strong) Settings *settings; but -Swift.h must be imported in .m file and .h does not know anything about settings.swift. Do…
Laxsion12
  • 67
  • 1
  • 8
2
votes
1 answer

CryptoSwift and Objective-C

How I can use CryptoSwift to my Objective-C project? I have an Objective-C project and want to use Encryption Library CryptoSwift for that. I have successfully used the single Swift file into my Objective-C project, but how to use a Swift project as…
2
votes
1 answer

Xcode 7.3 can't find 'Project-Swift.h' file

Assume my project is called "Project". My actual project name does not have any spaces either, so that's not an issue. I'm aware that to use a Swift file in Obj-C, you can add Project-Swift.h to the .m file. However, I get a 'Project-Swift.h' file…
gadu
  • 1,816
  • 1
  • 17
  • 31
2
votes
2 answers

Unrecognized selector sent to instance when attempting to call an extension method via a swift bridging header

I'm trying to call Objective-C code from Swift. I created a Swift Bridging Header, and added an import to the Objective-C file (e.g. #import "UIColor+Utils.h"). The project builds, and I even get code completion, but when it attempts to execute that…
Senseful
  • 86,719
  • 67
  • 308
  • 465
2
votes
1 answer

Swift bridging method call bug

Objective-C method typedef void(^CompletionHandler)(NSError *error); - (void)openWithCompletionHandler:(CompletionHandler)completionHandler authType:(AuthType)authType, ...; I have tried to convert the object c code into swift code. I tried…
1
vote
2 answers

How to use imported Swift protocols and classes in Objective-C code?

I have a project that bridges Swift and Objective-C both ways, and: I have a @objc protocol defined in a Swift file: @objc protocol Plugin { @objc func onDevicePackageReceived(np: NetworkPackage) -> Bool } All the classes that implement this…
Lucas W
  • 125
  • 1
  • 10
1
vote
0 answers

How to reference to current view in IOS using react-native?

I'm using payment SDK for the payment system in the react-native project. I'm creating bridges to open the Payment modal and sending the events back to react-native. I'm trying to reference the current view to open the payment modal on the view and…
1
vote
0 answers

SwiftUI's Canvas won't appear in Objective-C project

I'm trying to use SwiftUI in my Objective-C project, so I use this following step: this article after that, I'm success bridging this 2 files to my Objective-C project. but in my file SwiftUIFile.swift, my canvas cannot be resume. when I try to…
Axel
  • 73
  • 1
  • 11
1
vote
1 answer

Failing trying to use Objective-C library in my Swift project with bridging header

I think I have completed all the necessary steps for this, but it fails for some reason. This is the error I get: Showing All Messages Undefined symbol: _OBJC_CLASS_$_HCKBeaconCentralManager I have set the file in Build Settings: This is the…
somerandomusername
  • 1,993
  • 4
  • 23
  • 55
1
vote
1 answer

Swift cannot find private struct define in framework

I got a issue while using swift-bridge-header feature to access c code framework(liblinphone). A struct LinphoneCallParams which defined in types.h that can be found in framework header files. And the struct definition is as following typedef…
Angus
  • 11
  • 1
1
vote
0 answers

Auto Generated -Swift file not able to add Framework

I am working on a project where the code is in Objective-C & Swift 3.2, I am sending mail from Swift file where I need to extend MFMailViewControllerDelgate but when I Build project I get an error Can not find protocol declaration for…
1
vote
1 answer

mymodule-swift.h file not found

This is what I have a project level. and I have the same setup using $(inherited) in targets. But now I'm getting the file not found error. What I'm doing wrong?
Ricardo
  • 7,921
  • 14
  • 64
  • 111
1
vote
1 answer

calling swift file in seperate project from objective c project. Apple Mach-o Linker error

we have a legacy iOS objective C app. We want to add "swift" functionality. Created a separate "Cocoa touch framework" project to reference it from the "objective C" project. I am getting this error when I try to call/init any of the methods in…
teeboy
  • 408
  • 3
  • 13
1
vote
1 answer

Add animation to objective-c microphone detection

I have two separate projects: one that has png animations set by a timer and counter to keep looping when the user presses start/stop (swift). The other detecting when the user blows into the iPhones microphone (objective c). I want to join both of…
1
vote
2 answers

Mixing Swift and ObjC pods doesn't work

I have a podfile with only Objective-C pods, that looks like this: source 'https://github.com/CocoaPods/Specs.git' target "myProject" do pod 'GoogleMaps' pod 'GooglePlaces' pod 'GooglePlacePicker' pod 'GoogleMaps' pod 'RMMapper' …
FS.O6
  • 1,394
  • 2
  • 20
  • 42