I have a framework project that has both Swift and Objective-C code. I am unable to import or use Swift class inside Objective-C code. This issue is happening in a framework project. I didn't face this issue in other non-frameworks projects.
Asked
Active
Viewed 383 times
1
-
Does the Swift class inherit from an Obj-C class or via @objc? See https://stackoverflow.com/questions/30795117/when-to-use-objc-in-swift/46496642 – EricS Dec 26 '19 at 05:51
-
@EricS I tried this.. but its not working for me. – Anil Arigela Dec 26 '19 at 05:52
-
Are you adding "YourModuleName-Swift.h" to the objective class? – Emre Önder Dec 26 '19 at 05:57
-
@EmreÖnder Yes I am. – Anil Arigela Dec 26 '19 at 05:58
-
"Always Embed Standart Swift Libraries" option in build settings is No or yes? – Emre Önder Dec 26 '19 at 06:00
-
Add header file for use of objective c file in project. https://stackoverflow.com/questions/2093069/xcode-how-to-include-c-library-and-header-file-to-cocoa-project – Vibha Dec 26 '19 at 06:00
-
@EmreÖnder that option was set to "No". Changing it to "Yes" didn't work though. – Anil Arigela Dec 26 '19 at 06:03
-
can you clean the project and build it again after import statement added? – ammar shahid Dec 26 '19 at 06:10
-
is framework added from pod or custom added by you? – ammar shahid Dec 26 '19 at 06:12
-
Custom added. The issue is in the framework source code itself though. – Anil Arigela Dec 26 '19 at 06:16
-
see this link : https://stackoverflow.com/a/24102880/8687925 – SAXENA Dec 26 '19 at 17:07
1 Answers
-1
- create a swift class in you project then automatically show alert create bridging header file create option.
- swift file import in bridging header file
- user your swift file in objective c

Sushil Vyas
- 60
- 5