I am trying to create a new Cocoa Touch Framework for iOS in Swift, using some libraries from Cocoapods, but I can't have it work. I know there are some opened questions about that, but none of them seem to fix my problem.
For testing purposes, I just created an empty Cocoa Touch Framework, installed Cocoapods and added the 'MBProgressHUD' pod. Then, as documented by Apple ('Importing Code from Within the Same Framework Target' section), I imported the MBProgressHUD header in my umbrella header like that:
#import "MBProgressHUD.h"
But when I compile, I have this error:
include of non-modular header inside framework module
I did set the 'Allow Non-modular includes in Framework Modules' setting to Yes, but it doesn't have any effect.
Is there any way to use CocoaPods in a Swift Framework?
I found the solution, so I will let it here in case someone else has the same issue.
So, Cocoapods supports iOS frameworks since version 0.36, and as it's said in their blog, to use it in a framework, you just have to add this line in your Podfile:
After that, in a Swift framework, you don't need to include the .h files in your umbrella header, but you do need to import the module wherever you need it, for instance:
This is working for me, hope it helps!
Using 'Objective-C bridging header' we can make use of Objective-C frameworks in Swift.
Refer the following, It will explain how to make use of Objective-C framework(For example Parse framework) in Swift.
• Link1
• Link2