Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

AxoNeuron

macrumors 65816
Original poster
Apr 22, 2012
1,251
855
The Left Coast
Hey guys,

At my company, we have an iOS app and a macOS 'admin' dashboard app. These projects share a lot of code, so what I've done is I've created a 'core' framework to encapsulate all of the data models/logic.

But it's a HUGE pain in the behind, because every time I need to make even a minor change to this framework, I have to rebuild it and import it in the iOS/macOS projects. Debugging can take a huge amount of time this way.

Has anyone ever used a private cocoapod for a framework like this? Or is there an even better solution I'm unaware of?
 
I have a similar setup with two apps that share some view controllers. It's setup as a private cocoapod. There is an example app that is part of the private cocoapod that I use for development of the cocoapod. The data and some of the configuration of the shared code is a little different between the two apps so there are a set of protocols that provide the data and some of the configuration for the view controllers. The protocols are adopted by classes in the two apps and also in the test app.

For simple changes in the shared code I just work in the shared code project. Once the work is committed to master I just 'pod update' in the two apps and I'm done. For complex changes I work in a branch in the shared code. Then I make a branch in the two apps and adjust my Podfile to pull the branch from the private cocoapod. 'pod update' then pulls the branch from the private cocoa pod and I can test the new code and do whatever integration needs to be done. Once everything is working correctly I merge the private cocoa pod to master, return my Podfiles to pull from master, 'pod update', merge my app code to master, and I'm done.

If you look at public cocoapods I think you'll see that many have example projects that use them and are part of the cocoapod. That seems to be the part you're missing. Another way to drive the shared code is with unit tests, but that doesn't work well for UI code.

The other way I've heard of for this kind of design is to use git submodules, but I've also read that they're evil. I've never used one.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.