Question

I have created a number of re-usable classes that I use across xcode projects, for example: Utility EmailController MarketingController FlashLightController etc

I had been simply copying these class files from and back into a central repository, but now I have a number of apps it is all getting a little confusing from a config management point of view. So I was looking for an alternative.

I started investigating Static Libraries but they seem to be quite a lot of more effort for simply re-using code (e.g. different libs for device vs simulator, still having to have copies of .h files, etc).

Does anyone know of a decent alternative for quick and easy code reuse?

Thanks, Charlie

Was it helpful?

Solution

You can put the code files into a project without actually copying them into the project. In other words, just keep the class files in a completely separate location. Import them into many projects, but uncheck the option to copy them in. The projects will still refer to them successfully. Now a change made in the class files will propagate to every project that uses them.

Also, consider whether workspaces will help you.

In my view, almost anything is better than making a library or framework!

OTHER TIPS

Static libraries would probably be your best bet, as I have used them and have found them to be pretty easy to use. (I haven't had to use different libraries for device or simulator, mine works on them all). Having the header isn't that annoying, and static libraries are really the only way (outside of dynamic libraries, which are banned by apple) other than copying the files to reuse code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top