ios - How to get the correct autocomplete in XCode for a block variable? -


i have block thats stored instance variable in class

typedef void ((^didselectword)(nsstring* word)); @property (nonatomic,strong) didselectword wordselected; 

and want xcode auto fillout block when type [uiview animatewithduration , xcode autocompletes block it.

when autocomplete block fills out

[self.suggestedsearchtermview setwordselected:(didselectword)wordselected 

instead of

[self.suggestedsearchtermview setwordselected:^(nsstring *word) { 

is possible change make xcode understand how autocomplete block?

ok did testing.

apparently have 2 (far perfect) options:

  1. avoid typedef , declare property as

    @property (nonatomic,strong) void (^wordselected)(nsstring * word); 

    as noted in comments, has drawback of skipping parameter name in autocompletion.

  2. explicitly add setter declaration in interface

    typedef void ((^didselectwordblock)(nsstring* word));  @interface yourclass : nsobject  @property (nonatomic,strong) didselectwordblock wordselected; - (void)setwordselected:(didselectwordblock)wordselected;  @end 

    this cause xcode resolve type definition before setter definition, giving nice autocompletion expect. obvious drawback setter declaration in interface.

that said, should fill in bug report: http://openradar.appspot.com/


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -