47

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).

Community
  • 1
  • 1
Richard Stelling
  • 25,607
  • 27
  • 108
  • 188
  • 1
    Not sure if I understand everything. But isn't a MyCoolApp.xcodeproj with your own frameworks and targets, then a MyCoolApp.xcworkspace generated by CocoaPods that links the Pods.xcodeproj to your own code? – Felipe Cypriano Jul 31 '15 at 20:46
  • I would looove to know the answer to this too (and the current answers don't really address the question) - I've wasted so much time shuffling around folders and "groups" (an alien concept to me, coming from Windows) trying to get frameworks, Swift classes, Obj-C code, .a files, etc. detected correctly, with mixed success. I tried using CocoaPods on the naive belief it would make things easier, but it downloaded a few hundred megs before it even let me use the few-KB plugin I wanted. Stuck mostly to Carthage and manual plugins after that. ;) – Extragorey Jan 11 '17 at 23:59

2 Answers2

1

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.

SilentLupin
  • 658
  • 10
  • 16
  • 1
    You really could turn this into an answer. Give an example of how you might set this project up and it becomes a pretty good answer. – Jacksonkr Aug 15 '17 at 13:39
0

I really think that you can use Cocoapods to create your workspace in this case, because it really helps you out, and you can add the components you want to each one of your own frameworks.

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

workspace ‘Project.xcworkspace'

target 'Project.Models’ do
xcodeproj ‘Project/Models.xcodeproj’
pod 'Alamofire', '~> 2.0'
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'

end

target 'Project.Business' do
xcodeproj ‘ Project/Project.Business.xcodeproj’

pod 'Alamofire', '~> 2.0'
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'

end

For example here is one example in how I manage to handle multiple Frameworks with multiple dependencies and resolve it into one main workspace that has all the dependencies for 3rd party libraries for each one of my projects

Hope this gives you a Hint or help you to resolve something.

ItamarG3
  • 4,092
  • 6
  • 31
  • 44
Yeis Gallegos
  • 444
  • 2
  • 14