How do you define a method in your own classes that accepts an NSString with format?
I see several different things using it like NSLog, [NSPredicate predicateWithFormat:(NSString *)predicateFormat, ...] and of course [NSString stringWithFormat:(NSString *)format, ...]
Also, in the header files, NSLog and stringWithFormat have the following after their declaration:
NS_FORMAT_FUNCTION(1,2). Googling didn’t help much with telling me what this meant.
Obviously the ellipsis is the format parameters, but I don’t know how to deal with them in the method itself.
You’re looking for Objective-C methods with variable number of arguments. Here is how it’s done:
Declaration in the header:
Implementation:
Source: Cocoa With Love.