A delightful, simple library for aspect oriented programming. 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. Aspects hooks deep into the class hierarchy and creates dynamic subclasses, much like KVO. There's known issues with this approach, and to this date (February 2019) I STRICTLY DO NOT RECOMMEND TO USE Aspects IN PRODUCTION CODE. We use it for partial test mocks in, PSPDFKit, an iOS PDF framework that ships with apps like Dropbox or Evernote, it's also very useful for quickly hacking something up. Aspects uses _objc_msgForward which causes issues with other code that uses message forwarding.

Features

  • Adding aspects returns an opaque token of type AspectToken which can be used to deregister again
  • All calls are thread-safe
  • Aspects uses Objective-C message forwarding to hook into messages
  • Aspects calls and matches block arguments
  • Blocks without arguments are supported as well
  • Aspect-oriented programming (AOP) is used to encapsulate "cross-cutting" concerns

Project Samples

Project Activity

See All Activity >

Categories

Libraries

License

MIT License

Follow Aspects

Aspects Web Site

You Might Also Like
Relax: PRTG Monitors Your IT for You Icon
Relax: PRTG Monitors Your IT for You

Stay in control and avoid IT headaches. PRTG monitors your network, devices, and apps - receive alerts when it matters most.

You’re the go-to IT person, always putting out fires and keeping things running. With PRTG, you get reliable alerts to monitor your entire IT infrastructure, without the noise. Our intuitive setup gives you a clear overview of your network, devices, and applications in real time. Get instant alerts only when something needs your attention, whether you’re at your desk or on the move. Spend less time worrying about outages and more time focusing on what matters. Set up PRTG once and let it work for you - PRTG has you covered.
Start Your Free PRTG Trial Now
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of Aspects!

Additional Project Details

Operating Systems

Apple iPhone, Mac

Programming Language

Objective C

Related Categories

Objective C Libraries

Registered

2021-07-12