NSMethodSignature

Provides type information about method arguments and return values. Supports MetaABI and method frame layout.

Base Class

NSObject

Implemented Protocols

Instance Variables

uint32_t                            _bits;    // Method descriptor bits
uint16_t                            _count;   // Number of types
uint16_t                            _extra;   // Extra storage size
char                               *_types;   // Type encodings
MulleObjCMethodSignatureTypeInfo   *_infos;  // Type information

Methods

Creation

Method Information

Type Information

MetaABI Support

Usage Example

// Get method signature
NSMethodSignature *sig = [target methodSignatureForSelector:@selector(method:)];

// Check argument count
NSUInteger args = [sig numberOfArguments];  // Includes self and _cmd

// Get argument types
char *type = [sig getArgumentTypeAtIndex:2];  // First user argument

// Get return type
char *returnType = [sig methodReturnType];

// Check method properties
BOOL isOneway = [sig isOneway];
BOOL hasVarArgs = [sig isVariadic];

// Get sizes for allocation
NSUInteger frameSize = [sig frameLength];
NSUInteger metaABISize = [sig mulleMetaABIFrameLength];

Important Notes

  1. Type Encoding
  2. Memory Layout
  3. Performance
  4. Thread Safety
  5. MetaABI Types
typedef enum {
    MulleObjCMetaABITypeVoid = 0,
    MulleObjCMetaABITypeVoidPointer = 1,
    MulleObjCMetaABITypeParameterBlock = 2
} MulleObjCMetaABIType;