具有多个项目和Coca Pod设置的Xcode工作区

时间:2023-01-17 17:15:29

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

好吧,让我们从基础知识开始,因为我无法使其工作(请参阅Xcode工作区 - 未找到从框架项目窗格导入的内容)...

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

我想创建一个包含两个项目的Xcode工作区:

  1. Cocoa Touch Framework Swift project
  2. Cocoa Touch Framework Swift项目
  3. Swift Demo app project for the framework
  4. 该框架的Swift Demo app项目

Nr. 2 should also contain a UI Testing target.

NR。 2还应包含UI测试目标。

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.

然后我想使用Cocoapods提供整个工作区(两个项目!)作为一个pod我想将框架项目“链接”到演示应用程序项目中,以便可以在那里使用它。

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

有人可以指导我通过这个包括。 pod文件需要如何查找?

1 个解决方案

#1


1  

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

希望这可以帮助

#1


1  

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

希望这可以帮助