File Structure with more structural (class hierarchy) information


I always group methods in my classes by the class or interface the methods are coming from.

An example.m:

#pragma mark UIViewController overrides

-(void) viewDidLoad { }

-(void) viewWillAppear:(BOOL)animated { }

#pragma mark UITableViewDelegate

-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { }

And so on. I'd like to see my pragma marks in the file structure tool window and popup so I get a better sense of how the class is structured. Alternatively I'd like to see the class the method is overridden from or the protocol the method is implementing in the structure, automatically. As AppCode already knows this information to use with the Override Methods / Implement Methods (which I would like to see in a combined dialog, by the way), it wouldn't probably be too hard to use the information for grouping methods in the Structure window. It could possibly an option to group by this "origin" or "declaration" of the method.

So instead of a flat list of methods in the file I'd like to see them grouped by their "origin" or "level" (in the sense of class hierarchy and which class a method comes from).

This kind of grouping in my mind makes the classes more organized and clean, and it's easier to see the customization points (in terms of overriding superclass behaviors) in my classes.

One kind of super advanced heuristic inspection would be to use the grouping information then to see if I've made a typo in overriding a superclass method or implementing a protocol method. If a method is in a "#pragma mark UITableViewDelegate" section, I could get a warning about method that's close, but not quite a known UITableViewDelegate protocol method, for example:

-(void) tbleView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { }

Though unused method inspection might already catch this?


Please sign in to leave a comment.