I was woundering if it is possible to make an action that can receive different types of objects. For example if I want to pass UILabels and UIButtons, to the same action, but only one at the time. What I’m not looking for is something like this:
- (void)actionInitWithButton:(UIButton *)button Label:(UILabel *)label;
More something like this:
- (void)actionInitWithObject:(UniversalObject *)object;
Thanks in advance 🙂
In Objective-C, they’re simply called
id. It’s a principal concept of the language.The alternative is
NSObject, but this is typically used for subclassing —idcovers a more broad spectrum as not all (but most) objects inherit fromNSObject.Ex.