25

Usually Xcode autocomplete works really well for me but when tabbing through method signatures with blocks and block variables I always have to retype the variable types and names. Here's an example:

block variable without autocomplete

The animation block is easy to complete since it has no block variables and thus I only have to type ^{} before I can start writing code. With the second completion block I have to type out ^(BOOL fin){} before I can start writing code. This example is somewhat simplistic but with multiple types where some of the names are longer (such as AFHTTPRequestOperation) it becomes a pain and it feels like a situation where Xcode would otherwise autocomplete.

Am I missing some trick for autocompleting these block variables or am I stuck retyping them every time?

Nick
  • 9,792
  • 7
  • 50
  • 60

1 Answers1

53

Tab until the entire block section is highlighted. Rather than typing, just hit return and the example block will be expanded.

Nick
  • 9,792
  • 7
  • 50
  • 60
Sean
  • 5,810
  • 2
  • 33
  • 41
  • This is how regular autocomplete works, sure. As you can see the whole set of block variables are in a blue cell so tabbing selects the whole thing, not the individual variables within. – Nick May 04 '12 at 20:01
  • 1
    yes, and when you hit return, the entire string of text ^(BOOL finished) {} will be written into your code – Sean May 04 '12 at 20:03
  • Thanks! I clarified the answer a bit. – Nick May 04 '12 at 20:07