Swift and Cocoapods - Required Module Missing
I am trying to create a Swift framework. This structure depends on two libraries, Alamofire and SwiftyJSON , which are both written in Swift.
I am using CocoaPods to import these libraries into my frameworks. Here is the content of my subfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'Alamofire', '1.2'
pod 'SwiftyJSON', '2.2'
Within my framework, I have a class that imports and uses these two modules:
import Alamofire
import SwiftyJSON
I can run pod install
and compile my framework successfully !
Now things get complicated when I try to use my framework in a Swift project.
- I am copying the file
.framework
to my project. - In the build steps of my project target, I add a Copy Files phase with Target set to Frames and add the framework file.
-
I am importing my framework into the Swift class of my project:
import MyFramework
Problem: Xcode keeps telling me
Required module 'SwiftyJSON' is missing
And even more surprising: if I don't use SwiftyJSON and remove it from my framework (but still use Alamofire) ... It works! And I have the same problem with any other lib, SwiftyJSON. Only Alamofire seems to work.
I've already seen some problems like this one and tried some things (changing build settings, adding libraries to Linked Libraries, adding a bridge header, although I'm not dealing with ObjC) with no effect ...
Does anyone have any ideas on how to solve this problem? It drives me crazy!
EDIT: I am using Cocoapods v0.37.0.b.1. Same problem with v0.36.4.
source to share