Skip to content

Demerro/TwitterSideMenu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Twitter Side Panel Implementation

A Swift implementation of Twitter's interactive side menu panel with realistic physics-based animations.

Features

  • 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

demo.mp4

Implementation Details

Architecture

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

Key Components

Side Menu

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.

Physics-Based Animations

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

Gesture Handling

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

Usage

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.

License

This project is available under the MIT license.

Acknowledgments

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.

About

Twitter side menu with UIKit

Topics

Resources

License

Stars

Watchers

Forks

Languages