DEV Community

Cover image for SwiftUI List Complete Guide: Move, Delete, Pin & Custom Actions (2025 Edition)
Karan Pal
Karan Pal

Posted on • Originally published at swift-pal.com

SwiftUI List Complete Guide: Move, Delete, Pin & Custom Actions (2025 Edition)

SwiftUI Lists: From Basic to Custom Actions (Complete 2025 Guide)

Ever been in this situation? You're building what seems like a simple list, everything's working fine, and then your PM drops the bomb: "Can users delete items? Oh, and we need them to pin favorites too."

Suddenly your clean List becomes a tangled mess of state management issues and broken animations. 😤

The Real Problem

Most SwiftUI List tutorials show you the happy path, but they don't prepare you for the real challenges:

  • Delete actions that don't actually remove items
  • Move operations that mysteriously revert back
  • Custom actions that feel clunky and un-iOS-like
  • State management nightmares when you scale beyond 5 items

What You'll Learn

In this comprehensive guide, I'll show you:

// ✅ This actually works (complete example)
struct TaskRowWithSwipeActions: View {
    @ObservedObject var taskManager: TaskManager
    let task: TodoItem

    var body: some View {
        HStack {
            Image(systemName: task.isCompleted ? "checkmark.circle.fill" : "circle")
                .foregroundColor(task.isCompleted ? .green : .gray)
            Text(task.title)
            Spacer()
            if task.isPinned {
                Image(systemName: "pin.fill")
                    .foregroundColor(.orange)
            }
        }
        .swipeActions(edge: .trailing) {
            Button("Delete") {
                taskManager.deleteTask(task)
            }
            .tint(.red)

            Button(task.isPinned ? "Unpin" : "Pin") {
                taskManager.togglePin(for: task)
            }
            .tint(.orange)
        }
    }
}
Enter fullscreen mode Exit fullscreen mode

Key Insights from the Trenches

🔍 State Management is Everything
The difference between a smooth list and a buggy mess? Understanding when to use @State vs @ObservedObject vs @StateObject. Get this wrong, and your actions will behave unpredictably.

🎨 Custom Actions Done Right
SwiftUI's .swipeActions() gives you that native iOS feel, but there are specific patterns for pinning, archiving, and custom behaviors that feel professional.

🚀 Navigation Integration
Lists aren't just data display — they're navigation hubs. Master-detail patterns, deep linking, and search integration can make or break your app's UX.

⚡ Performance Patterns
Real apps have hundreds or thousands of items. The patterns that work for 5 demo items fall apart at scale.

What Makes This Different

Every code example in this guide is:

  • Complete and runnable — no "figure out the rest yourself"
  • Production-tested — patterns that work with real data
  • Copy-paste ready — immediately usable in your projects
  • Explained thoroughly — understand the "why" behind each choice

Ready to Build Better Lists?

Whether you're new to SwiftUI or fighting with existing list implementations, this guide covers everything from fundamentals to advanced customization.

👀 What's your biggest SwiftUI List challenge? Drop a comment — I love helping fellow developers solve tricky UI problems!

📖 Read the complete guide: SwiftUI List Complete Guide: Move, Delete, Pin & Custom Actions

🎬 Watch the complete tutorial here: SwiftUI Lists Complete Guide


Follow me for more SwiftUI deep dives and iOS development tips that actually work in production! 🚀

Top comments (0)