explaingit

ramotion/folding-cell

10,199SwiftAudience · developerComplexity · 2/5LicenseSetup · easy

TLDR

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.

Mindmap

mindmap
  root((repo))
    What it does
      Folding card animation
      Expand and collapse rows
      UITableView cells
    Setup
      CocoaPods install
      Swift Package Manager
      Single Swift file copy
    How it works
      Foreground compact view
      Container expanded view
      Row height tracking
    Audience
      iOS developers
      Swift developers
      Mobile UI builders
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Add a folding card animation to a UITableView in an iOS app so rows reveal hidden detail when tapped.

USE CASE 2

Replace a plain expandable cell in an existing Swift app with a visually distinctive folding animation.

USE CASE 3

Use the Android port to implement the same folding card UI in a cross-platform mobile project.

Tech stack

SwiftUIKitCocoaPodsSwift Package Manager

Getting it running

Difficulty · easy Time to first run · 30min

Requires wiring FoldingCell outlets and managing row heights in your UITableViewController.

MIT license, use freely in any project including commercial apps, include the copyright notice and credit the creator if used commercially.

In plain English

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.

Copy-paste prompts

Prompt 1
Add FoldingCell to my Swift iOS UITableView so tapping a row unfolds it to show an image, title, and description card.
Prompt 2
How do I configure the foreground and container views for FoldingCell using Auto Layout constraints in Xcode Interface Builder?
Prompt 3
Using FoldingCell, write the UITableViewController code that tracks which row is open and ensures only one cell is expanded at a time.
Prompt 4
Install FoldingCell via Swift Package Manager in Xcode 15 and wire it up to a custom UITableViewCell subclass.
Prompt 5
How do I customize the fold animation duration and number of fold segments in FoldingCell?
Open on GitHub → Explain another repo

← ramotion on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.