In Objective-C 2.0, is it possible to make a method where the argument is optional? That is, you can have a method call like this:
[aFraction print];
To avoid the Parse issue: 'aVariable' used as the name of the previous parameter rather than as part of the selector you get from the compiler as a warning you should do:
- (void)printWithParameter:(BOOL)sv color:(NSColor *)color{
// your cool code goes here
if ( sv ) {
NSLog(@"cool stuff turned on");
}
else {
NSLog(@"cool stuff turned off");
}
}
and you could call the method, such:
[self printWithParameter:NO color:[UIColor someColor]] // NO instead of 0
or
[self printWithParameter:YES color:[UIColor someColor]] // YES instead of 1