What are the digits in an ObjC method type encoding string?
-
20-06-2021 - |
Question
I'm reading Apple's article about Objective-C runtime type encoding strings and some methods have numbers in their type strings.
What do the numbers in v12@0:4@8
mean?
Solution
This looks like an encoding of a setter method like this:
- (void) setSomething:(id) anObject
To break it down:
v
means void return type12
means the size of the argument frame (12 bytes)@0
means that there is an Objective-C object type at byte offset 0 of the argument frame (this is the implicitself
object in each Objective-C method):4
means that there is a selector at byte offset 4 (this is the implicit_cmd
in every method, which is the selector that was used to invoke the method).@8
means that there is another Objective-C object type at byte offset 8.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow