Monday, January 24, 2011

Add Text Files to your Xcode Project

I just started using this technique a few months ago (I know, seasoned developers are probably laughing at me...) but I have since found it to be extremely helpful.

Being a very small Indie iOS developer, I usually have more than one project "in the works" and I will have an idea or I find some really cool sound effect or maybe some new code snipit that I want to use / include in one of my projects. How and where do you track that?

I keep any number of text files in my project that I can quickly reference right from inside Xcode. Here's a very quick "How To"

Step 1
Create your text files using TextEdit (or your favorite editor) and save them in your projects folder (you can even use a sub-folder). In TextEdit just hold {CMD} + {SHIFT} + {T} to switch from RTF to plain text.

Step 2
I create an Xcode group to keep my text files together, it's up to you.




Step 3
Add the file(s) but make to to DE-SELECT your app in the "Add to Targets" checkbox, otherwise you'll get errors about not knowing how to compile a txt file (or something).



Step 4
Revise and update directly inside Xcode.



You can use RTF files too, it's just not as easy to edit the type stuff.


And of course we have a sample project that you can download here.


PS This technique will also work for fonts that you used while making your assets. I learned this the hard way after I reformatted my old iMac and wasted several hours trying to track down a missing font that I used in a PSD file.

Happy Coding

No comments:

Post a Comment