The main answer to your question: yes, you can use objective-c code created using CocoaPods.
More important question: "How to use such libraries?" The answer to this question depends on the use_frameworks! flag use_frameworks! in your Podfile :
Imagine you want to use objective-c pod named CoolObjectiveCLib .
If your pod file uses the use_frameworks! flag use_frameworks! :
// Podfile use_frameworks! pod 'CoolObjectiveCLib'
Then you do not need to add bridge header files.
All you need is an import framework in the Swift source file:
// MyClass.swift import CoolObjectiveCLib
Now you can use all the classes provided in lib.
If your pod file does not use the use_frameworks! flag use_frameworks! :
// Podfile pod 'CoolObjectiveCLib'
Then you need to create a bridge header file and import there all the necessary objective-c headers:
// MyApp-Bridging-Header
Now you can use all classes defined in the imported headers.
Vlad Papko Aug 07 '15 at 19:27 2015-08-07 19:27
source share