syclonefx
syclonefx

Reputation: 2990

Is there a way to put the .h and .m file in a central location to use in any of my projects?

In one of my projects I have a class that has just some standard code that I use in most off the apps and I thought it would be useful to use this class in some other projects. Is there a way to put the .h and .m file in a central location to use in any of my projects? I could make changes to the class and would not have to worry about having to correct the files in multiple places.

Upvotes: 1

Views: 98

Answers (3)

Rahul Vyas
Rahul Vyas

Reputation: 28720

Yes you can leave the files at a central location and add only refrences of the class to your project by dragging onto xcode into your project. Just do not copy files when xcode asks for it. Like we do for some third party libraries for ex. core-plot,facebook, Three20 etc.

Upvotes: 0

syclonefx
syclonefx

Reputation: 2990

I found it was easier to save my .h & .m file in a folder called MyClasses, then drag both files in to the project I want to add them to. Xcode gives you the option to copy the files in to my project or leave them where they are. I left them in my MyClasses folder. I can now edited this class and all my changes show up in all the apps I have this class in.

Upvotes: 1

bioffe
bioffe

Reputation: 6393

For XCode 4.2 you could use a workspace, which can be comprised of multiple projects. Let's say you want to build a static lib. You can have a dedicated project for a lib, and include this project in multiple workspaces. You will need to properly setup project dependencies, so changes in your lib would be automatically picked up next time you build a product.

Upvotes: 2

Related Questions