Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to structure a Xcode project with Frameworks, Extensions and CocoaPods

NB: Here is a more abstract and simplified sub-set of this question.

With the addition of Touch Frameworks, Extensions and the Apple Watch Xcode 6 projects and workspaces are getting more and more complex.

If you add CocoaPods into this mix things start to get almost unmanageable.

How would I structure an Xcode project/Workspace with the following targets and dependancies? (Assumptions: I am using Git for all the components, I am using CocoaPods for all third party code, I am using Xcode 6).

  • MyCoolApp
    • Several 3rd Party UI libraries via CocoaPods
    • MyCoolNetworking.framework, a framework (project) I created as a Git Sub-module
      • AFNetworking via CocoaPods
      • Other data processing code via CocoaPods
    • MyCoolAppBusinessLogic.framework, used by app and all extensions (below)
      • Includes some code from CocoaPods common to app and extensions
    • MyCoolToadyView, a TodayView Extension target
    • MyCoolWatch, an Apple Watch extension target

As you can see this is a complex structure including a couple of CocoaPods instances. Any advice on how to solve any or all of these issues will be helpful.

(My plan is to write up some of my own ideas and then synthesise an answer from everyone else, this will no doubt be a living document).

like image 689
Richard Stelling Avatar asked Jan 22 '15 10:01

Richard Stelling


People also ask

How do I add frameworks in Xcode?

To include a framework in your Xcode project, choose Project > Add to Project and select the framework directory. Alternatively, you can control-click your project group and choose Add Files > Existing Frameworks from the contextual menu.


1 Answers

More of a comment than an answer, but I don't have enough reputation for it: Have you tried using the cocoapods xcode plugin? I use it and it structures the pods on its own, so I don't even have to worry about it.

like image 96
SilentLupin Avatar answered Sep 20 '22 07:09

SilentLupin