Okay I am not asking HOW to get a parameter when calling a method or something.
I want something like this:
-(void)doSomethingWithType:(TYPE)type {
//do something
}
and executed like this:
[self doSomethingWithType:int];
or
[self doSomethingWithType:BOOL];
How can I make a parameter of a method/function that has a type as parameter? I mean any type.. :)
I dont want to make a int parameter, I want to make a int-type parameter, where you write the objective c type as parameter and not a value or variable :)
Thanks!
I'm not sure if I understand your intention correctly, but Objective-C has a class "Class".
-(void)doSomethingWithType:(Class)type {
//do something
//for example, create an instance of this type:
id object = [[type alloc] init];
}
And you can call it like so:
[objectOfMyClass doSomethingWithType: [SomeObjectiveCType class]];
It won't work with primitive types though. I mean BOOL, int, float, etc. Objective-C classes only. Hope, that it will help. Sorry if that's not what you're looking for.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With