# steipete/Aspects

Delightful, simple library for aspect oriented programming in Objective-C and Swift.

Repository: https://github.com/steipete/Aspects
Canonical: https://ross.abutalabs.com/products/aspects
Homepage: https://twitter.com/steipete
Language: Objective-C
License: MIT
License Family: permissive
Topics: objectivec, aspects, objective-c, hooks, swift
Archived: true
Last push: 2025-11-25T13:09:18+00:00

## Health v2 (maintenance only)
Score: 10/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 54, release rhythm 8, longevity 100
- inputs: {"age_days": 4505, "days_push": 281, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: archived
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 8422, forks 1266 (observed 2026-08-28T04:10:21.100377+00:00)

## What it is
Aspects is a small Objective-C/Swift library for aspect-oriented programming that hooks into existing methods per class or per instance using message forwarding and dynamic subclasses. It is essentially method swizzling made easy, with before/instead/after insertion points and thread-safe token-based deregistration.

## Use cases
- add logging or analytics to existing iOS methods without subclassing
- mock parts of a method in tests
- hook into view controller lifecycle methods
- patch third-party framework behavior at runtime
- quickly prototype behavior changes via method hooks

## When to choose
- you need lightweight AOP or method swizzling in Objective-C/Swift
- you want per-instance or per-class method hooks with before/instead/after options
- you need partial test mocks in an iOS codebase
- you're hacking on a prototype and need quick runtime hooks

## When to avoid
- the author explicitly does not recommend it for production code
- you need to hook methods called at high frequency (message forwarding overhead)
- you need to hook static methods
- your codebase relies heavily on message forwarding, which conflicts with _objc_msgForward

## Facets
- artifact type: library
- maturity: maintenance
- function: middleware, developer-tools, testing, mocking
- domain: developer-tools, mobile-development, apple-ecosystem
- platform: cpp
- tags: aspect-oriented-programming, method-swizzling, objective-c, aop, hooks, runtime, ios, macos, swift

## Member repositories
- steipete/Aspects (main) score 10

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:10:21.100377+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T17:27:16.594558+00:00, confidence not recorded.
  - readme: https://github.com/steipete/Aspects (fetched 2026-08-28T04:10:21.100377+00:00, sha a2a91f2d1995)
- Data as of 2026-08-30T08:39:29.467469+00:00.
