SwiftUI: How to make custom Swipe-able Cell

Prafulla Singh
2 min readApr 27, 2021

Xcode 12.4 — iOS 14

In this tutorial, We are going to implement custom swipe action in list cell.

We will be using LazyVStack with ScrollView. It is more customisable compare to list.

We are going to divide this problem into following segments

  1. Create Simple List View with or without header.
  2. Create Custom Action Buttons.
  3. Create a view modifier. This view modifier will be used to listen swipe gesture
  4. On swipe direction, show/hide relevant buttons
  5. Add View extension utility so that we can easily use view modifier.

Simple List View:

We create a custom cell, Which shows cell index. Create a LazyVStack bind with Scroll view to lazily load cells(load only visible cells)

In custom cell, we also add Divider() to make it look like table view cell.

Create Demo Action buttons:

--

--

Prafulla Singh
Prafulla Singh

Responses (1)