BadmintonCat
BadmintonCat

Reputation: 9586

Xcode Workspace with Multiple Projects and Coca Pods Setup

Ok, let's start with the basics since I cannot friggin get this to work (see Xcode Workspace - Not finding imports from framework project pod)...

I want to create an Xcode workspace that has two projects:

  1. Cocoa Touch Framework Swift project
  2. Swift Demo app project for the framework

Nr. 2 should also contain a UI Testing target.

Then I want to use Cocoapods to provide the WHOLE workspace (both projects!) as a pod AND I want to 'link' the framework project into the demo app project so that it can be used there.

Can somebody guide me through this incl. how the pod file needs to look for this?

Upvotes: 1

Views: 2076

Answers (1)

Reinier Melian
Reinier Melian

Reputation: 20804

You need define the pods that will be common for all your projects first

# Uncomment this line to define a global platform for your project
platform :ios, '8.2'
# Uncomment this line if you're using Swift
use_frameworks!

# Define main pods.
def main_pods

    #your main pods
    pod 'AwesomeCache', '~> 5.0'
    pod 'DZNEmptyDataSet', '1.8.1'


end

# Your FirstProjectName.
target 'FirstProyectName' do

    main_pods
    #here you can add any other for this specific project
    pod 'Branch'

end

# Your SecondProjectName.
target 'SecondProjectName' do

    main_pods
    #here you can add any other for this specific project
    pod 'Alamofire'
    pod 'Fabric'
    pod 'Crashlitycs'

end

target 'FirstProjectTestName' do

end

target 'FirstProjectTestUIName' do

end

post_install do |installer|
        puts("Update debug pod settings to speed up build time")
        Dir.glob(File.join("Pods", "**", "Pods*{debug,Private}.xcconfig")).each do |file|
            File.open(file, 'a') { |f| f.puts "\nDEBUG_INFORMATION_FORMAT = dwarf" }
        end
    end
end

Hope this helps

Upvotes: 2

Related Questions