| Start |
|---|
| Augmenting methods using Method Swizzling The Objective-C runtime allows you to change the implementation of a method at runtime. This is called method swizzling and is often used to exchange the implementations of two methods. For example, if the methods This technique can be used to augment or "patch" existing methods which you cannot edit directly, such as methods of system-provided classes. In the following example, the IMPORTANT: Many people try to do swizzling using If you need to swizzle a method that takes parameters, you just add them as additional parameters to the function. For example: |
| Attach object to another existing object (association) It's possible to attach an object to an existing object as if there was a new property. This is called association and allows one to extend existing objects. It can be used to provide storage when adding a property via a class extension or otherwise add additional information to an existing object. The associated object is automatically released by the runtime once the target object is deallocated. |
| Calling methods directly If you need to call an Objective-C method from C code, you have two ways: using
RemarksIn order to use the Objective-C runtime, you need to import it. |
Read Article
https://develop.horje.com/learn/1434/reference