folding-cell
:octocat: 📃 FoldingCell is an expanding content cell with animation made by @Ramotion
A Swift library for iOS that adds a paper-folding expand and collapse animation to table view rows, tap a row and it unfolds like a card to reveal more content, tap again to fold it back.
FoldingCell is a Swift library for iOS that adds an animated expanding cell to list views (UITableView). When a user taps a row, it unfolds like a piece of paper, revealing additional content beneath. The visual effect is inspired by the look of physical folded cards from material design.
The library provides a custom cell class called FoldingCell that you use as the base for your own cells in Xcode. A cell has two parts: a foreground view, which is the compact version shown when the row is collapsed, and a container view, which holds the expanded content shown after the row is tapped. When the user taps a row, the foreground view unfolds downward in segments to reveal the container view, and tapping again folds it back up.
To add it to a project, you can use CocoaPods, Carthage, Swift Package Manager, or simply copy the single Swift file directly into your Xcode project. The setup involves connecting your views to two outlets on the cell and configuring a few constraints in your storyboard. The table view controller then needs a small amount of code to track which cells are open or closed and update row heights accordingly.
The library also exists as an Android port for developers who want a similar effect on that platform. It is released under the MIT license and was created by Ramotion, a mobile design and development agency that publishes a collection of open source UI components across multiple repositories. The README requests credit and a backlink if you use it in a commercial project.
Where it fits
- Add a folding card animation to a UITableView in an iOS app so rows reveal hidden detail when tapped.
- Replace a plain expandable cell in an existing Swift app with a visually distinctive folding animation.
- Use the Android port to implement the same folding card UI in a cross-platform mobile project.