I want to create a method like this:
- (void) checkAndUpdateStringProperty: (NSString **) property{
if (...)
*property = @\"whatever\";
}
>
I'd do this using the selectors instead (you'll have to convert it to a c function to get it to work without warning (see here):
- (void) checkAndUpdateStringProperty: (SEL)setter {
if (...)
IMP imp = [self methodForSelector:setter];
void (*func)(id, SEL, id) = (void *)imp;
func(self, setter, @"whatever");
}
Use this to pass in the selector for the same class:
- (void) somewhereElse{
....
[self checkAndUpdateStringProperty:@selector(setProductName:)];
}