I am trying to make a Swift framework. This framework depends on two libraries, Alamofire and SwiftyJSON, which are both written in Swift.
I am using CocoaPods to import these libraries in my framework. Here is the content of my Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'Alamofire', '1.2'
pod 'SwiftyJSON', '2.2'
In my framework, I have a class that imports and uses these two modules:
import Alamofire
import SwiftyJSON
I can run pod install
and build my framework successfully!
Now things get tricky when I'm trying to use my framework in a Swift project.
- I copy the
.framework
file into my project. - In the Build Phases of my project's target, I add a Copy Files Phase with "Destination" set to "Frameworks", and add my framework file.
I import my framework in a Swift class of my project:
import MyFramework
The problem is: Xcode keeps telling me
Missing required module 'SwiftyJSON'
And 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 than SwiftyJSON. Only Alamofire seems to work.
I've already seen some issues, like this one, and tried some things (changing Build Settings, adding the libraries to the Linked Libraries, adding a Bridging Header though I'm not dealing with ObjC) with no effect...
Does anyone have any ideas on how to solve this problem? It's driving me nuts!
EDIT: I'm using Cocoapods v0.37.0.beta.1. Same issue with v0.36.4.
Problem solved after updating Xcode to version 6.3.1.