A Swift implementation of Twitter's interactive side menu panel with realistic physics-based animations.
- Custom side menu panel with smooth animations
- Physics-based gesture interactions using damped harmonic spring
- Rubber-banding effect for natural interactions
- Interactive transitions with velocity-sensitive animations
- Twitter-style UI elements and layout
demo.mp4
The project is organized with a clear separation of concerns:
- ApplicationUI: Contains the main application flow controller and view
- SideMenuUI: Implements the side menu components and interaction logic
- SwiftUtilities: General Swift utility extensions and functions
- UIKitUtilities: UIKit-specific utilities for animations and gesture handling
The side menu is implemented as a collection view with a custom header. It includes:
- User profile information with avatar
- Following/Followers statistics
- Navigation items like Profile, Lists, Topics, etc.
The application uses realistic physics-based animations:
DampedHarmonicSpring
: Models spring physics for natural animations- Rubber-banding: Provides resistance at the boundaries of motion
- Velocity-sensitive transitions: Menu follows the user's gesture velocity
The side panel can be revealed with a pan gesture that:
- Tracks translation and velocity
- Projects the final position based on gesture velocity
- Applies appropriate spring animations for completion
The side menu can be accessed by swiping from the left edge of the screen. The animation will complete based on the velocity and distance of the gesture.
This project is available under the MIT license.
The physics-based animations are inspired by Apple's WWDC sessions on fluid interfaces and incorporate concepts from real-world physics for natural-feeling interactions.