#include <objc/objc.h>

objc/objc.h

includes: stdlib.h, Availability.h, objc/objc-api.h, stdbool.h
9 functions · 8 typedefs · 6 macros · 1 struct

typedefClass

An opaque type that represents an Objective-C class.
typedef struct objc_class *Class

structobjc_object

Represents an instance of a class.
size 8, align 8
Classisa

typedefid

A pointer to an instance of a class.
typedef struct objc_object *id

typedefProtocol

typedef struct objc_object Protocol

typedefSEL

An opaque type that represents a method selector.
typedef struct objc_selector *SEL

typedefIMP

A pointer to the function of a method implementation.
typedef void (*IMP)(void /* id, SEL, ... */ )

macroOBJC_BOOL_IS_BOOL

Honor __OBJC_BOOL_IS_BOOL when available.
#define OBJC_BOOL_IS_BOOL 1

typedefBOOL

typedef bool BOOL

macroOBJC_BOOL_DEFINED

#define OBJC_BOOL_DEFINED 

macroYES

#define YES __objc_yes

macroNO

#define NO __objc_no

macroNil

#define Nil __DARWIN_NULL

macronil

#define nil __DARWIN_NULL

typedefobjc_zone_t

Forward declaration for zone support
typedef struct _malloc_zone_t *objc_zone_t

functionsel_getName

OBJC_AVAILABLE(10.0, 2.0, 9.0, 1.0, 2.0)
OBJC_EXPORT const char * _Nonnull sel_getName(SEL _Nonnull sel)
Returns the name of the method specified by a given selector. @param sel A pointer of type \c SEL. Pass the selector whose name you wish to determine. @return A C string indicating the name of the selector.

functionsel_registerName

OBJC_AVAILABLE(10.0, 2.0, 9.0, 1.0, 2.0)
OBJC_EXPORT SEL _Nonnull sel_registerName(const char * _Nonnull str)
Registers a method with the Objective-C runtime system, maps the method name to a selector, and returns the selector value. @param str A pointer to a C string. Pass the name of the method you wish to register. @return A pointer of type SEL specifying the selector for the named method. @note You must register a method name with the Objective-C runtime system to obtain the method’s selector before you can add the method to a class definition. If the method name has already been registered, this function simply returns the selector.

functionobject_getClassName

OBJC_AVAILABLE(10.0, 2.0, 9.0, 1.0, 2.0)
OBJC_EXPORT const char * _Nonnull object_getClassName(id _Nullable obj)
Returns the class name of a given object. @param obj An Objective-C object. @return The name of the class of which \e obj is an instance.

functionobject_getIndexedIvars

OBJC_AVAILABLE(10.0, 2.0, 9.0, 1.0, 2.0)
OBJC_EXPORT void * _Nullable object_getIndexedIvars(id _Nullable obj)
Returns a pointer to any extra bytes allocated with an instance given object. @param obj An Objective-C object. @return A pointer to any extra bytes allocated with \e obj. If \e obj was not allocated with any extra bytes, then dereferencing the returned pointer is undefined. @note This function returns a pointer to any extra bytes allocated with the instance (as specified by \c class_createInstance with extraBytes>0). This memory follows the object's ordinary ivars, but may not be adjacent to the last ivar. @note The returned pointer is guaranteed to be pointer-size aligned, even if the area following the object's last ivar is less aligned than that. Alignment greater than pointer-size is never guaranteed, even if the area following the object's last ivar is more aligned than that. @note In a garbage-collected environment, the memory is scanned conservatively.

functionsel_isMapped

OBJC_AVAILABLE(10.0, 2.0, 9.0, 1.0, 2.0)
OBJC_EXPORT BOOL sel_isMapped(SEL _Nonnull sel)
Identifies a selector as being valid or invalid. @param sel The selector you want to identify. @return YES if selector is valid and has a function implementation, NO otherwise. @warning On some platforms, an invalid reference (to invalid memory addresses) can cause a crash.

functionsel_getUid

OBJC_AVAILABLE(10.0, 2.0, 9.0, 1.0, 2.0)
OBJC_EXPORT SEL _Nonnull sel_getUid(const char * _Nonnull str)
Registers a method name with the Objective-C runtime system. @param str A pointer to a C string. Pass the name of the method you wish to register. @return A pointer of type SEL specifying the selector for the named method. @note The implementation of this method is identical to the implementation of \c sel_registerName. @note Prior to OS X version 10.0, this method tried to find the selector mapped to the given name and returned \c NULL if the selector was not found. This was changed for safety, because it was observed that many of the callers of this function did not check the return value for \c NULL.

typedefobjc_objectptr_t

typedef const void* objc_objectptr_t

functionobjc_retainedObject

OBJC_UNAVAILABLE("use CFBridgingRelease() or a (__bridge_transfer id) cast instead")
OBJC_EXPORT id _Nullable objc_retainedObject(objc_objectptr_t _Nullable obj)
not_available

functionobjc_unretainedObject

OBJC_UNAVAILABLE("use a (__bridge id) cast instead")
OBJC_EXPORT id _Nullable objc_unretainedObject(objc_objectptr_t _Nullable obj)
not_available

functionobjc_unretainedPointer

OBJC_UNAVAILABLE("use a __bridge cast instead")
OBJC_EXPORT objc_objectptr_t _Nullable objc_unretainedPointer(id _Nullable obj)
not_available