Improving Animations on iOS with Stagehand
Article Summary
Cash App just open-sourced Stagehand, their solution to a problem that's plagued iOS developers since 2008: building animations shouldn't feel like archaeology.
Nick Entin from Cash App traces the messy evolution of iOS animation APIs (from CoreAnimation's stringly-typed key paths to UIKit blocks) and introduces their modern Swift framework that finally brings compile-time safety and composability to animation development.
Key Takeaways
- Stagehand uses Swift key paths for compile-time safe animations, no more type-erased values
- Composable structure lets you build complex multi-part animations from reusable components
- Construction separates from execution: define animations before creating the views to animate
- Visual snapshot testing for animations catches regressions with GIF comparisons
- Works with custom types via protocol conformance, not just views and layers
Critical Insight
Cash App's Stagehand framework brings modern Swift patterns to iOS animations with compile-time safety, composability, and visual snapshot testing built in.