explaingit

mortimergoro/mgswipetablecell

6,922Objective-CAudience · developerComplexity · 2/5Setup · easy

TLDR

MGSwipeTableCell is an iOS library that adds swipe-to-reveal action buttons to list rows in your app, like the Delete and Archive buttons in Apple Mail, with just one line of code change.

Mindmap

mindmap
  root((MGSwipeTableCell))
    What it does
      Swipe-to-reveal buttons
      iOS table rows
      One line setup
    Button styles
      Border transition
      Clip reveal
      3D rotation
    Platforms
      iOS 7 to 14
      iPhone and iPad
    Integration
      Objective-C
      Swift
      CocoaPods
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 swipe-left-to-delete and swipe-right-to-archive buttons to any iOS table view with a single class name change.

USE CASE 2

Implement a Spotify-style swipe row with a 3D rotation reveal animation and custom icon buttons on both sides of a list row.

USE CASE 3

Attach custom UIView buttons to list rows and use the delegate pattern to delay creating those buttons until they are actually swiped.

Tech stack

Objective-CSwiftCocoaPodsCarthageSwift Package ManageriOS

Getting it running

Difficulty · easy Time to first run · 30min
No explicit license information was provided in the explanation, check the repository before using commercially.

In plain English

MGSwipeTableCell is an iOS library that adds swipe-to-reveal buttons to list rows in an iPhone or iPad app. In iOS apps, a list view is built from rows called table cells. This library lets developers attach action buttons to those rows, so that swiping left or right on a row reveals buttons like Delete, Archive, or any other custom action, similar to how Apple's own Mail app works. The library supports several visual styles for how the buttons appear when a row is swiped. Border, clip, 3D rotation, static, and drag transitions are all available, each giving a different look and feel to the reveal animation. Developers can place buttons on the left side, the right side, or both, and can choose different transition styles for each side independently. Setting it up requires changing a single word in the code: the table cell class name is changed from UITableViewCell to MGSwipeTableCell, and that one substitution is enough to get basic swipe behavior working. Buttons are assigned as a simple list and can be standard text buttons, icon buttons, or any custom UIView the developer provides. The library also supports an optional delegate pattern, which delays creating buttons until they are actually needed, keeping memory usage lower in long lists. The library works with Objective-C and Swift, can be installed through CocoaPods, Carthage, or Swift Package Manager, and is compatible with all the different ways iOS developers create table cells: predefined system styles, code-only cells, cells from interface files, and prototype cells in storyboards. It has been tested on iOS 7 through iOS 14 on both iPhone and iPad. Demo projects included in the repository show swipe behavior modeled after Apple Mail and Spotify.

Copy-paste prompts

Prompt 1
Using MGSwipeTableCell in Swift, add a red Delete button on the left and a green Archive button on the right of a UITableViewCell, with the clip reveal style.
Prompt 2
Help me implement the MGSwipeTableCellDelegate pattern so swipe buttons are only created when the user actually swipes, keeping memory low for a 10,000-row list.
Prompt 3
I want swipe buttons in my table cell to look like Apple Mail. What MGSwipeTableCell transition style and button configuration should I use?
Prompt 4
Show me how to add an icon-only swipe button using a custom UIImage to a MGSwipeTableCell in Swift.
Open on GitHub → Explain another repo

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

Verify against the repo before relying on details.