Table of contents
Share Post

I’ve made a class including static & dynamics methods (say myWonderfulTool.h), that I want to use in all my other .m files without having to always call the syntax :[code=”c#”]#include “myWonderfulTool.h”[/code]

This is very simple to do.

For every project you get a “.pch” file. For example if your project is called “MyProject”, then you’ve got a file name “MyProject.pch”

All you have to do is to add the include preprocessor command into this .pch file[code=”c#”]#include “myWonderfulTool.h”[/code]

After doing that, all your other sources will have access to your methods.

Note : in the current version of XCode 4 (version 4.2 while writing this article), it seems that the autocompletion and the color syntaxing is buggy when working with methods & definitions added by the .pch file… Hope it’ll be fixed in a future version, because it worked fine in the previous (before 4.0) version of XCode.

laurent

Stay in the loop

Subscribe to our free newsletter.

Related Articles