-
Notifications
You must be signed in to change notification settings - Fork 368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use this framework with objective-c? #28
Comments
Hey @afiq90! Well this framework wasn't thought for Objective C to be honest, and it's been a while since I do a project with it, so I don't know how that stuff work anymore to do a Swift - Objective C podfile. Sorry about that. |
The "Importing Swift into Objective-C" section gives instructions on how to do this. |
Thank's @bjones2015. |
+1 I really like the concept and would like to use in an obj-c project. |
As is, it will not run from Obj-C. Obj-C cannot use Swift structs or functions outside of a class declaration. To use this as is, you need to add a "bridge" layer by adding a swift class, reachable from Obj-C, that passes the call on to the swift version. I did something like this
Then in ViewController.m
|
@bcbroom What is #import "WhisperTest-swift.h" from? Can you give more info on this class? I am trying get the WhisperBridge swift file to be recognized in obj-c class. I get file not found when I use #import "WhisperBridge-Swift.h" in obj-c class. |
Its a generated header file - the pattern is "TargetName"-Swift.h. My project (and default target name) was "WhisperTest". There is only one for the whole target, not one for each Swift file. |
@bcbroom Oh I see. Thanks and I changed it and it worked. 👍 |
@bcbroom that is amazing, thanks for answering this issue and finding a feasible solution for Objective-C support; mind adding it to the |
So 🔝 @bcbroom! :) |
How to use this framework with objective-c?
The text was updated successfully, but these errors were encountered: