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

React Native / Swift Native module work only once

I use a swift native module in my react native ios app to generate an animated gif from assets url. It's working well at the first try but when I escape the component and pass new assets after it was used once, the app crash, sometimes displaying…
0
votes
1 answer

How can I create a NSGradient from an array of colors and floats?

I have an array of NSColors, and an array of CGFloats signifying gradient stops. I can't figure out how to use these arrays to initialize a NSGradient. I tried making these into an array of (NSColor, CGFloat)s, but NSGradient(colorsAndLocations:…
Ky -
  • 30,724
  • 51
  • 192
  • 308
0
votes
1 answer

how to send data from one ViewController to another which has SWRevealViewController

I have impleented SWRevealViewController for sideMenu. My project is is Swift and SWRevealViewController is in Objective-c. SWRevealViewController is not initial view Controller.there is one intial View Contoller(1VC) and it has Push segue on…
0
votes
1 answer

importing swift file to obj-c

Okay, this one is too much for me. I'm trying to import manually file from socket-io which are written in swift, to my project who is fully written in obj-c. I have read the doc from Swift and obj-c, but that's not really helpful at all. And from…
Mr Bonjour
  • 3,330
  • 2
  • 23
  • 46
0
votes
0 answers

Unable to Create Swift Class with non ASCII characters

I'm trying to create the following class: @objc(GameFacade) class GameFaçade: NSObject { ... } However when I try to compile I get the following error: Parameter of 'swift_name' attribute must be an ASCII identifier string This error is on my…
fpg1503
  • 7,492
  • 6
  • 29
  • 49
0
votes
1 answer

Call Swift from embedded Objective C framework

I have an app written in Swift called ColorApp which makes calls to ASwiftFramework (a collection of my swift files) as well as AnObjCFramework (an embedded framework of Objective C files). In my top level bridging header I only have: #import…
Mozahler
  • 4,958
  • 6
  • 36
  • 56
0
votes
1 answer

File not found error in bridging header file

I have an objective-c project. It is about two years that I am working on it. Now I want to do new works with Swift. I added a new Swift class. Xcode asked me to add BridggingHeader file and I pressed YES. but now in the bridging header file I want…
Husein Behboudi Rad
  • 5,434
  • 11
  • 57
  • 115
0
votes
1 answer

Is there a way to override "property" setters and getters in Swift?

After reading @property/@synthesize equivalent in swift, I became curious for how the functionality from Objective C was retained. Say I have the following in Objective C: @interface MyClass @property (readwrite) MyType *myVar; @end This can be…
Ky -
  • 30,724
  • 51
  • 192
  • 308
0
votes
1 answer

Bridging Header Issues

I'm trying to add a Swift file to my app and get a "Failed to import bridging header" error, among others. Bridging-Header code: // // Use this file to import your target's public headers that you would like to expose to Swift. // #import…
raginggoat
  • 3,570
  • 10
  • 48
  • 108
-1
votes
1 answer

Using Objective-C Singleton in Swift file within Objective-C project

I've got my project written in Objective-C. I am learning about bridging. I bridged successfully Swift into my Objective-C project. I did some VC pushing between Objective-C VC and Swift VC. Everything works as it supposed to. However, I created the…
Jakub Gawecki
  • 801
  • 2
  • 6
  • 14
-1
votes
1 answer

SlideMenuControllerSwift implementation in Objective-C

I try to add SlideMenuControllerSwift in Objective-c. I can access [slideMenuController openLeft] in my AppDelegate.m - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { UIStoryboard *sb…
-2
votes
1 answer

Why can't I access objective-c methods even though file is in bridge?

I have a project with a lot of objective-c code. Now I would like to access that code in my swift files. But for some reason I can't access the objective-c methods even though I can initiate an object of that class. I have a bridge-file with all…
1 2 3 4 5 6 7
8