Is XCode able to implement Code Sense when conforming to a protocol?

368 Views Asked by At

So XCode has been driving me crazy.. When writing iPhone apps using pickers or table views, when I state that the controller conforms to the DataSource and Delegate methods, XCode isn't generating code sense for those respective methods, and it's driving me nuts given how wordy some of them are..

Like -(NSInteger) tableView: (UITableView *) tableView indentationLevelForRowAtIndexPath: (NSIndexPath *) indexPath;

..I don't want to have to type that out every time I implement that. Is there a setting I've missed, or does XCode not dive into a protocol after you state you conform to it to generate code sense?

2

There are 2 best solutions below

0
On BEST ANSWER

Not now, apparently.

0
On

I am looking into this right now. I am also baffled as to why there are not snippets for all the major delegate things you are going to use 10 ways to Sunday. I did a snippet recently for UITableViewDataSourceDelegate and that is very worthwhile. Wasted a bunch of time trying to get an Edit Menu to popup on a collection view cell last night that ended up being delegate methods in the docs not having the exact required syntax.

It is super clear how this should work. Two choices (not either/or, both should be supported):

  1. As you say, I declare myself a delegate, I put in the - and start typing the method name, there should be a completion.
  2. When Xcode notes that I have an incomplete implementation, in general, not just of delegates, it should have a quickfix to add stubs for chrissakes. That would take them no time to implement.

This is the last area in which eclipse really trounces Xcode. I don't understand the reluctance to just slam the door on this once and for all.