How to efficiently add iOS infrastructure to an iOS project

Work has recently started on an iOS project written by swift and objective-c. At the moment we have a monolithic repo. We are now focusing on building multiple frameworks so that we can reuse the same infrastructure for multiple applications. I would like to know your opinion on the following points.

  • If I add framework.xcodeproj to my client application project, I can access the public infrastructure objects after writing the import statement. My concern is every time I create a client application project, this framework.xcodeproj compiles as well, although it doesn't change since the last build and doesn't depend on any other framework.

  • If I add a framework by adding it as framework.framework and making it injected into the inline framework, I can access the public objects of the framework. What is alarming in this case is, "whenever I change the framework code, I need to update the framework in the client application project."

Is there a way to include the infrastructure in the client application project where I can access public objects and it doesn't get the assembly every time I create the client application project?

It's absolutely okay if the framework get build when updating the code.

I have used Visual Studio in the past, which allowed me to create my client project without creating dependent projects as long as no code change occurs in the dependent projects.

+1


source to share


1 answer


If the structure is created every time you create the application depends on the type of the structure:

There are Cocoa Touch Static Libraries and Cocoa Touch Frameworks.

Cocoa Touch Frames

They are always open source and will be built just like your application. (So ​​Xcode will sometimes compile it when the app starts, and always after cleaning the project.) Frameworks only supports iOS 8 and newer, but you can use Swift and Objective-C within the framework.

Cocoa Click Static Libraries

As the name says, they are static. Therefore, they are already compiled when you import them into your project. You can share them with others without showing them your code. Please note that Static Libraries do not currently support Swift. You will need to use Objective-C in the library. The application itself can still be written in Swift.



Conclusion

If you don't mind using Objective-C, the Static Libraries seem to fit your requirement that the framework should only be built once.

But since I love Swift, I personally recommend that you use frameworks (if you don't mind letting others who use the framework see your code). My experience has shown that this is not a big problem, that the structure is created sometimes.


AddThis wrote a good blog post on whether to use static libraries or frameworks.

Cocoa Touch Static Library vs. Cocoa Touch Framework

+3


source







All Articles