Monitoring Performance of Screens in Your iOS App
Article Summary
Revolut's iOS team was drowning in vague performance reports. "This screen is laggy" became a detective hunt through Xcode Profiler with no clear starting point.
Arsen Gasparyan, an iOS developer on Revolut's trading product, built an automated performance monitoring system that measures every screen's lifecycle without manual instrumentation. The solution uses method swizzling and runtime magic to track viewDidLoad, viewWillAppear, and viewDidAppear execution times.
Key Takeaways
- os_signpost integrates with Instruments to pinpoint exact performance bottlenecks in viewDidLoad
- Method swizzling UIViewController.loadView enables automatic measurement across all screen subclasses
- Dynamic function creation at runtime prevents swizzling conflicts between different ViewControllers
- System filters out private controllers and SDK classes to avoid crashes
- Always-on monitoring catches performance regressions before they reach production
Critical Insight
The team now has continuous, automated performance tracking for every iOS screen without writing a single line of measurement code per controller.