0 votes
in Technology by (1.7m points)

Reflection? Class Introspection? is there anything in objc and cocoa?

1 Answer

0 votes
by (1.7m points)

Class Introspection: It is the ability to provide information about objects/classes at runtime . Objective C runtime supports introspection. A small sample of the type of information provided by the objC runtime

  1. names of methods of class from a class object.

2) information about method arguments

3) implementation(IMP) of individual methods of a class

4) Information about instance variables of a class

Reflection: Its the ability to add new classes and to add/modify interfaces of existing classes. It also includes the ability to modify the relationship between classes For example, the objC runtime allows new classes to be added, methods to be added to a class and instance variables to be added to a class created at runtime. It also allows the superclass of a class to be replaced by another class.

Swizzling: The term “Swizzling” in objective C refers to exchanging the implementation of two methods(class or instance) at runtime. So you apply introspection to access method implementations and reflection to actually exchange the method implementation to achieve swizzling.