Xcode Pods functions not found in ModuleName-Swift.h

1.6k views Asked by At

Because of a constraining library, I need to use Objective-C files in my Swift project.
So, I added the import module-Swift.h in my .m file.
It finds it without any issues.
The problem come from the auto-generated module-Swift.h" file.
I have a lot of errors, mainly from classes and protocols coming from Pods.
Image

Image

Image

Is there any config to fix this issue ?

2

There are 2 answers

0
Anas A. On BEST ANSWER

Thanks to Kavitha Madhu, I found the solution !

For those who encounter the same issue:

If you want to use Swift classes and functions in you Objective-C code.
But, some of you Swift functions use Pods protocols and delegates.
You need to add in your Objective-C code the import of the pods headers that contain these protocols and delegates.

For example, if your module-Swift.h doesn't find "SlideNavigationControllerDelegate", you need to add in the Objective-C file (which use "module-Swift.h") the line:
#import <iOS_Slide_Menu/SlideNavigationController.h>

1
Kavitha Madhu On

If you want to use objective c files in swift project, bridge the Objective files.

1)Create a new header file and name it like "your project name-Bridging-Header.h". The file must be saved to your project folder

2)Select your xcode project -> select your build target -> select build settings -> click the "all" option at the top -> search for Swift Compiler - General

3)Select Objective-C Bridging Header and give the path as $(PROJECT_DIR)/$(PROJECT_NAME)/$(PROJECT_NAME)-Bridging-Header.h

4)Finally add your objective files into the header file.