Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Auto-generate Objective-C method headers from implementation?

Is there a tool that will take a list of Objective-C methods and produce the corresponding header definitions?

Often when writing code in my implementation file, I find I need to add, remove, or modify method definitions. This requires the tedious (and thoroughly-automatable) step of switching back to my header file and making the exact same changes, twice.

What ever happened to DRY? What kind of tools can I use to make life easier here? Thanks.

like image 733
Yetanotherjosh Avatar asked Feb 08 '11 00:02

Yetanotherjosh


2 Answers

You can try Accessorizer: http://www.kevincallahan.org/software/accessorizer.html

It automates most work regarding properties, it might work for methods too.

Sadly, it's not free.

like image 161
Cristian Radu Avatar answered Sep 28 '22 13:09

Cristian Radu


I don't know of any existing tools (although Interface Builder does allow you to define outlets and actions, and then generate a header and implementation skeleton for you based on those). Remember though that the implementation file can contain information that should not go in the header (such as private methods and instance variables/properties), so it would be difficult for any tool to do this in any case.

For the moment, in Xcode, you can split the window and see both side by side (in Xcode 4, this is the Assistant). Alternatively, you can press Alt-Command-UpArrow to see the corresponding file.

like image 37
FeifanZ Avatar answered Sep 28 '22 14:09

FeifanZ