Coding key values ββcan help you with this. There are primitives (e.g. valueForKey:
that can validate an object for ivars and perform conversions for inline ones. In this sense, you must pass functions to the keys (the ivar name as strings) and let the system perform NSNumber
conversions, where types are C primitives. Of course, this will lead to some overhead.
You can also come close to this using objc runtime, but KVC will most likely do everything you need without resorting to using the objc runtime (on its own).
If you want to determine if the va_list
parameter is BOOL
, then you will need to specify it (therefore formatting specifiers are needed). An alternative that you see in some cases -[NSArray initWithObjects:...]
- in this case, the initializer requires objc objects for each parameter, as well as nil-term; You will need to do the promotion object BOOL
β.
Alternative: C ++ can provide you with all this information (e.g. using templates).
source share