title: Swift framework depending on cocoa pod
body: <p>Using the newest version of cocoa pods (0.36) I am able to embed cocoa pods written in swift (e.g. Alamofire) into my swift project.
  Now I introduced a custom framework of my own into the project, which also wants to depend on Alamofire.</p>
  
  <p>What I did in order to accomplish that is to select add the pods framework to my framework as dependency:</p>
  
  <p>Select the Target for my own embedded Swift Framework (Swift Module) and in the "General" tab in the "Linked frameworks and libraries" I added "Pods.framework" as "Required".</p>
  
  <p>However, that is not enough in order to compile as the classes in my own swift framework can not "import Alamofire" as it is not recognised as "available framework".</p>
  
  <p>Adding the Pods.debug.xcconfig and the Pods.release.xcconfig file to the Configurations for the target of my own swift framework, in other words changing the build settings to do all the changes, that cocoa pods do to the build settings of my iOS App target, solves the problem.</p>
  
  <p>It now builds without a problem. It also runs without a problem in the Simulator and my own embedded swift framework successfully uses the frameworks added by cocoa pods.</p>
  
  <p>HOWEVER if I run the same on a device, it compiles and installs without a problem, but then crashes with a fatal error on launch:</p>
  
  <pre><code>dyld: Library not loaded: @rpath/Pods.framework/Pods
  Referenced from: /private/var/mobile/Containers/Bundle/Application/32D2F1F8-679F-4A5F-8159-28F1C800D0C6/TestingFrameworks.app/Frameworks/mySwiftFramework.framework/mySwiftFramework
  Reason: image not found
  </code></pre>
  
  <p>Apparently not all the settings from the cocoa pods xcconfig file are suited to be added to the build settings of my custom swift framework.</p>
  
  <p>But why does it work in the simulator then? And more important what is the build setting, which I need to correct?</p>
  
  <p>To me it looks like I need to change this build setting:</p>
  
  <pre><code>PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods
  </code></pre>
  
  <p>to something else...</p>