Skip to content

augmify/SwipeCellKit

Repository files navigation

SwipeCellKit

Build StatusVersion StatusSwift 3.0license MITPlatformCarthage compatibleTwitter

Swipeable UITableViewCell based on the stock Mail.app, implemented in Swift.

About

A swipeable UITableViewCell with support for:

  • Left and right swipe actions
  • Action buttons with: text only, text + image, image only
  • Haptic Feedback
  • Customizable transitions: Border, Drag, and Reveal
  • Animated expansion when dragging past threshold

Demo

Transition Styles

The transition style describes how the action buttons are exposed during the swipe.

Border

Drag

Reveal

Expansion Styles

The expansion style describes the behavior when the cell is swiped past a defined threshold.

None

Selection

Destructive

Requirements

  • Swift 3.0
  • Xcode 8
  • iOS 10.0+

Installation

CocoaPods (recommended)

use_frameworks!# Latest release in CocoaPodspod'SwipeCellKit'# Get the latest on developpod'SwipeCellKit',:git=>'https://github.com/jerkoch/SwipeCellKit.git',:branch=>'develop'
github "jerkoch/SwipeCellKit"

Documentation

Read the docs. Generated with jazzy. Hosted by GitHub Pages.

Usage

Set the delegate property on SwipeTableViewCell:

overridefunc tableView(_ tableView:UITableView, cellForRowAt indexPath:IndexPath)->UITableViewCell{letcell= tableView.dequeueReusableCell(withIdentifier:"Cell")as!SwipeTableViewCell cell.delegate =selfreturn cell }

Adopt the SwipeTableViewCellDelegate protocol:

func tableView(_ tableView:UITableView, editActionsForRowAt indexPath:IndexPath, for orientation:SwipeActionsOrientation)->[SwipeAction]?{guard orientation ==.right else{returnnil}letdeleteAction=SwipeAction(style:.destructive, title:"Delete"){ action, indexPath in // handle action by updating model with deletion } // customize the action appearance deleteAction.image =UIImage(named:"delete")return[deleteAction]}

Optionally, you call implement the options method to customize the behavior of the swipe actions:

func tableView(_ tableView:UITableView, editActionsOptionsForRowAt indexPath:IndexPath, for orientation:SwipeActionsOrientation)->SwipeTableOptions{varoptions=SwipeTableOptions() options.expansionStyle =.destructive options.transitionStyle =.border return options }

Credits

Created and maintained by @jerkoch.

License

SwipeCellKit is released under an MIT License. See LICENSE for details.

Please provide attribution, it is greatly appreciated.

About

Swipeable UITableViewCell based on the stock Mail.app, implemented in Swift.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift97.8%
  • Ruby1.2%
  • Objective-C1.0%