A Swift and Objective-C method tracing library that logs invocations and enables aspect-oriented programming via trampolines.
SwiftTrace is a dynamic tracing library for Swift and Objective-C that intercepts and logs method invocations at runtime. It helps developers debug, profile, and monitor application behavior by providing visibility into method calls without modifying source code. The library also supports aspect-oriented programming, allowing injection of custom logic before or after method execution.
iOS and macOS developers working on complex applications who need advanced debugging, performance profiling, or runtime behavior analysis tools. It's particularly useful for those dealing with dynamic dispatch, framework integration, or aspect-oriented programming in Swift.
Developers choose SwiftTrace for its reliable trampoline-based interception (vs. traditional swizzling), comprehensive tracing capabilities across Swift and Objective-C, and unique features like aspect injection and object lifetime tracking not found in standard debugging tools.
Trace Swift and Objective-C method invocations
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Uses assembly-language trampolines instead of traditional swizzling, ensuring accurate method interception with minimal performance impact, as highlighted in the philosophy section.
Allows tracing of entire bundles, specific classes, instances, or protocols via regex patterns, enabling targeted debugging and profiling without source code changes.
Enables adding closures before or after method execution to modify arguments or return values, facilitating runtime behavior modifications for debugging or instrumentation.
Provides methods to measure invocation counts and elapsed times for performance analysis, plus object lifetime tracking for monitoring allocations and deallocations.
Cannot trace final classes or methods compiled with whole module optimization, restricting use in performance-optimized codebases, as admitted in the README.
Requires adding linker flags like '-Xlinker -interposable' for full functionality and involves low-level details for aspect programming, such as understanding register allocation.
The dynamic invocation API only supports a limited set of argument types (e.g., Double, Float, Int) and requires manual type conformances for custom structs, adding complexity.