Reputation: 43
Is there any way that an Objective-C method could operate on primitive parameters without knowing their types? For instance,
-(Any)returnFirst:(Any)first notSecond:(Any)second {
return first;
}
This could then be used like:
int a = [self returnFirst:500 notSecond:1000];
char b = [self returnFirst:'a' notSecond:'b'];
Upvotes: 3
Views: 2895
Reputation: 6732
In Swift 3, the
id
type in Objective-C now maps to theAny
type in Swift, which describes a value of any type, whether a class, enum, struct, or any other Swift type.
Source: https://developer.apple.com/swift/blog/?id=39
Upvotes: 1
Reputation: 385830
There is no equivalent to Any
in Objective-C. Your example returnFirst:notSecond:
cannot even be declared in Objective-C.
Upvotes: 1