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:
avoid
typedef
, declare property as@property (nonatomic,strong) void (^wordselected)(nsstring * word);
as noted in comments, has drawback of skipping parameter name in autocompletion.
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
Post a Comment