views:

67

answers:

2

Is there an easy way to convert an Objective-C 2.0 file to Objective-C 1? I am writing a Cocoa app, and I decided to support Tiger, which doesn't support Obj. C 2.0. I know I should have thought of it before I wrote a whole bunch of code, but is there an easy way to convert it back? Thanks!

+1  A: 
  • If you are using Garbage Collection, you'll need to undo that.
  • Remove all property usage (writing your own accessors where needed)
  • If you are iterating through collections via for(object in collection) you'll need to redo.
MarkPowell
Thanks! I'm not using GC, so that's taken care of. I use plenty of properties, though. Is there a script or tool that will let me convert it?
Adrian Sarli
I would search through Xcode plugins. But I have a feeling this is not a popular request. I've seen somethings that create properties, but not any that remove them.
MarkPowell
Write yourself a script, it's quite simple.
Georg
+2  A: 

Here's a Objective-C 1.0 foreach macro that can make converting the for(id obj in collection) loops a lot easier. Using it, you can say: foreach(id,obj,collection){…}. I used it for a couple of years before fast enumeration, and it worked great.

Vincent Gable
Looks great! Thanks!
Adrian Sarli