简体   繁体   English

将复杂的Xcode项目集成到另一个项目的最佳方法

[英]Best way to integrate a complex Xcode project into another

I would like to integrate an existing Xcode project A into another project B so the second one could reuse some features. 我想将现有的Xcode项目A集成到另一个项目B中,以便第二个项目可以重用某些功能。

Project A : 项目A:

  • quite complex, manage authenfication + session, a lot of dependencies betweens classes (notably UIViewController) 非常复杂,管理身份验证+会话,类之间有很多依赖关系(特别是UIViewController)
  • relies on a dozen of Cocoapods dependencies 依赖于十几个Cocoapods依赖项
  • the project lives on its own : it's a sale channel/ticket shop that is already deployed on the store as it 该项目独立存在:这是一个销售渠道/票务商店,已经在商店中部署了
  • constant evolution 不断发展

Project B : 项目B:

  • Project customer side that would love to integrate some parts of the sale channel 希望将销售渠道的某些部分整合在一起的项目客户方

  • Complexity might be very variable (using Cocoapods or not, etc) 复杂度可能变化很大(是否使用Cocoapods等)

Basically we can either deliver and package the e-commerce shop for one of our customer if he does not already have an iOS application, or we have to integrate it in their existing one. 基本上,我们可以为一位客户(如果他还没有iOS应用程序)提供电子商务商店并将其打包,或者我们必须将其集成到他们现有的iOS应用程序中。

Expectation : 期望值:

  • ideally we could pursue the evolution and iteration on the core Project A without having a lot of work to make it available for integration (it would be more cost efficient for us to work on a single project than on the core one and separate SDK/Library made from scratch) 理想情况下,我们可以在核心项目A上进行演化和迭代,而无需进行大量工作以使其可用于集成(与核心项目和单独的SDK /库相比,对单个项目进行工作将更具成本效益从头开始)
  • we want to make it easy to integrate for the customer on its own 我们希望简化与客户自身的集成

The approach we have been thinking to are : 我们一直在想的方法是:

  • build a .a library file. 建立一个.a库文件。 But it does not seem really practical considering the size of the project 但是考虑到项目的规模,这似乎并不实际。

  • dropping the .xcodeproj from A into B (à la ZXing), but it was a pain because of Cocoapods dependencies 将.xcodeproj从A放到B(la ZXing)中,但是由于Cocoapods的依赖性,这很痛苦

    • Simply adding all the classes from A into B (with a proper packaging into folders first), manage Cocoapods for B (add dependencies from A if Cocopoads already used or set it up), and make all imports easier by editing .pch accordingly. 只需将A中的所有类添加到B中(首先将其正确包装到文件夹中),管理B的Cocoapods(如果已经使用或设置了Cocopoads,则从A添加依赖项),并通过相应地编辑.pch来简化所有导入。

What would be your suggestion ? 您的建议是什么?

Since you are already using cocoapods I would try to do a private pod(s) with the shared characteristics. 由于您已经在使用cocoapods,因此我将尝试使用共享特征制作一个私人吊舱。 That way you can easily track versions across projects and use the same tool to manage all the dependencies. 这样,您可以轻松跟踪项目之间的版本,并使用同一工具来管理所有依赖项。

This approach also would make easier for the customer to integrate as he will see the shared code from the pod as long he has access to the repository but not the complete main project. 只要客户可以访问存储库但不能访问完整的主项目,该方法也将使客户更易于集成,因为他将看到来自pod的共享代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM