Earlier this year I mentioned a nice guide on avoiding issues when performing method swizzling.
Here’s a library from Peter Steinberger for aspect oriented programming allowing you to enhance existing methods like swizzling with a number of advantages.
As Peter states in the readme:
Think of Aspects as method swizzling on steroids. It allows you to add code to existing methods per class or per instance, whilst thinking of the insertion point e.g. before/instead/after. Aspects automatically deals with calling super and is easier to use than regular method swizzling.
You can find Aspects on Github here.
There are some use cases posted on the Github page and Peter also has a writeup about using Aspects over on his blog.
An excellent objective-c enhancement.
- Tutorial: How To Perform Objective-C Method Swizzling And Avoid Danger
- Example: How To Place An Image In A UIMenuItem By Using Method Swizzling
- Objective-C Runtime Additions Allows Swizzling Without Creating A Category And More
- iOS Library That Uses Swizzling To Draw Physics Bodies Makes Debugging Sprite Kit Physics Easier
- Open Source Library Providing Basic Generics Within Objective-C
Original article: Objective-C Aspect Oriented Programming Library For Easier And Safer Method Swizzling
©2014 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.




