According to this tutorial, we should add use_frameworks!
to Podfile
in Swift project. But how to use third-party code in .m
in the same project?
One possible way is,
use_frameworks!
to Podfile
...-Bridging-Header.h
But when I try to import header in ...-Bridging-Header.h
, it just throw *.h file not found
error, how to fix this issue?
Up to CocoaPods 1.4.x (included), it was NOT possible to use CocoaPods with Swift code without use_frameworks!
.
Nowadays, with CocoaPods 1.x.x (I verified it with 1.4.0), it's common to use use_frameworks!
for both Swift and ObjC projects: it allows for a mix of the two languages in any way you want without issues:
Nowadays, CocoaPods 1.5.0 supports integrating swift pods as static libraries. Try it (sudo gem install cocoapods
) and enjoy removing use_frameworks!
from your Podfile.
Note that for iOS:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With