
Hero
A Swift library for custom iOS and tvOS screen transitions, set up declaratively.
- Stars
- 22.5k
- Forks
- 1.7k
- Licence
- MIT
- Language
- Swift
- Last update
- 1.8 years ago
- Type
- Library
No commits in over a year — check for forks or alternatives before adopting.
What it is
Hero is a Swift library that makes custom animations between screens (view controllers) in iOS apps easier to build. It sits on top of UIKit's transition APIs, which the README describes as cumbersome, and lets developers match views across screens using a heroID and describe changes with heroModifiers. Developers use it to add polished transitions without writing low-level animation code.
- Animate a shared view (matched by heroID) from a list screen into a detail screen
- Apply a cascade or fade-and-scale effect to a set of cells as a screen opens
- Set a custom push, modal, or tab bar transition type on a view controller
- Make a transition respond to user gestures for interactive control
Great for
- iOS developers who want custom screen transitions without writing UIKit animation code by hand
- Developers who want shared-element style transitions between matching views
- Teams building Swift apps that use UINavigationController, UITabBarController, or modal presentations
- Developers who prefer setting up animations in code or in the storyboard
Not ideal for
- Projects that only need the standard iOS transitions, since the built-in ones may already be enough
- Developers building for Android, web, or other platforms, since the library is for iOS and tvOS only
- Anyone expecting a visual tool that needs no coding, since usage is through Swift code or storyboard settings
How to get it
- 1
Install with a package manager
You'll need: Xcode with Swift 4.0+ support (README badges list Xcode 10.0+) · CocoaPods, Carthage, Accio, or Swift Package Manager
Add to Podfile, then install (CocoaPods)
pod 'Hero'Install pods (CocoaPods)
pod install - 2
Run it
- Install Hero with one of the supported package managers
- Add import Hero in each file that uses it
- Set hero.isEnabled = true on the view controllers involved in the transition
- Assign matching hero.id values to the views on both screens
- 3
Get the most out of it
- Use hero.modalAnimationType, navigationAnimationType, or tabBarAnimationType to choose built-in template transitions
- Combine heroID with heroModifiers to create custom effects like fade, scale, and translate
- Use the cascade modifier on a parent view to animate its children in sequence
- Use selectBy(presenting:dismissing:) to set different animations for present and dismiss
- Explore the Usage Guide wiki and header docs for the full modifier list
Downloads
Strengths
- Declarative API: views are matched with a simple heroID property instead of manual animation code
- Works with Auto Layout, programmatic layout, UICollectionView, UITableView, and navigation or tab bar controllers, per the README
- Actively maintained on GitHub with about 22,000 stars, MIT license, and a documented usage guide
Trade-offs
- Limited to iOS and tvOS; not usable on other platforms
- The README is brief and points to an external wiki for detailed documentation
- Some behavior needs extra setup, such as the global coordinate space modifier for views being covered during a transition
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| Hero (this) | 22.5k | Library | intermediate | 1.8 years ago | iOS developers who want custom screen transitions without writing UIKit animation code by hand |
| NVActivityIndicatorView | 10.7k | Library | beginner | 8 months ago | iOS developers who want a ready-made loading indicator with many styles |
| SkeletonView | 12.9k | Library | beginner | 5 months ago | iOS developers building apps that load data from the network |
| animated-tab-bar | 11.1k | Library | intermediate | 4.8 years ago | iOS developers who want animated tab bar icons without writing the animation logic from scratch |
| folding-cell | 10.2k | Library | intermediate | 2.5 years ago | iOS developers building list screens with expandable items |
| Material | 12k | Library | intermediate | 4.5 years ago | iOS developers who want Material Design-style components without building them from scratch |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.