How can I swipe to delete photos in an app?

I’m trying to make an app where users can swipe to delete photos, but I can’t get the swipe gesture to work properly. The photos don’t get deleted or the UI doesn’t update. I really need help figuring out the best way to implement this feature. Has anyone done this before or can provide guidance?

Why Are We Still Paying to Clean Up Photos?

Alright, so picture this: I’m chilling, my iPhone is groaning under the weight of 13,000 blurry screenshots, lunch pics, and duplicate memes, and my patience is wearing thinner than my old phone case. What do I do? Hop into the App Store, obviously, expecting some sanity.

First thing that pops up, SwipeWipe. But hold up—$10 a WEEK? That’s over $500 a year to do the digital equivalent of taking out the trash. Sorry, but unless my phone is being cleaned by tiny elves, that pricing is wild.

Everyone’s Got That Free App… Right?

Out of pure stubbornness (and a dash of internet sleuthing), I tumble onto Clever Cleaner Swipe Photos App. It’s free, does the job, and isn’t constantly flashing glaring ‘SUBSCRIBE NOW’ banners like it’s Black Friday every day.

I swipe through my mess, and what do you know—no pop-ups, no sneaky upgrades, just a clean interface that lets me actually prune my photo jungle.

When Paywalls Get Aggressive

Compare that experience to SwipeWipe. Here’s what they hit me with before it even gets interesting:

Versus this cheerful ransom demand from SwipeWipe:

Look, if you want to fund your indie dev project, I get it—make a pro version with wild features or a one-time payment. But $10 a week? That’s not just bold, it’s historic levels of delusion in the land of mobile apps.

TL;DR—Don’t Pay for What’s Already Free

So, here’s my advice: check out Clever Cleaner Swipe Photos App for zero dollars. Unless you like burning cash on “premium” trash cans, your phone and your wallet will thank you.

2 Likes

Alright, let’s talk swiping to delete photos—one of those features that should be simple, but your app is acting like it’s trying to defy the laws of user interface physics. I see @mikeappsreviewer already dropped some spicy takes about overpriced apps and even linked a freebie, but let’s not get lost in price wars. Your actual question was about the mechanics: gestures and updating the UI.

Here’s the real deal—getting swipe-to-delete right is usually about these three things:

  1. Actual Swipe Detection: Don’t use generic tap or basic pan gestures if you want that polished, Tinder-ish swipe-to-delete experience. If you’re on iOS, go for UISwipeGestureRecognizer for a simple approach, or even better, implement custom UICollectionView “swipe actions” if you want things to feel native and snappy.

  2. Data Source Update: No matter what you do with gestures, if you don’t remove the photo from your app’s data array (like, say, an array of photo objects), your UI won’t ever truly reflect the change. Delete the item from the backing array before you update the UI.

  3. UI Refresh: This is where I see most new devs trip up. Just removing something from the data source isn’t enough. If you’re using a UICollectionView or UITableView, you need to call deleteItems(at:) or deleteRows(at:) on your collection/table. Otherwise, the cell will stay, mocking you in your moment of triumph.

If your UI still isn’t updating, double-check you’re not missing a main-thread update (UI updates on a background thread = disaster). And watch out for that classic “index out of range” error if you update your data AFTER the UI.

Here’s a (very) simplified code sketch for iOS with UICollectionView:

func collectionView(_ collectionView: UICollectionView, 
                   trailingSwipeActionsConfigurationForItemAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
    let delete = UIContextualAction(style: .destructive, title: 'Delete') { (action, view, completion) in
        self.photos.remove(at: indexPath.item)
        collectionView.deleteItems(at: [indexPath])
        completion(true)
    }
    return UISwipeActionsConfiguration(actions: [delete])
}

Of course, Android-land is a whole different thing—think ItemTouchHelper for swiping.

And yeah, you can save yourself the headache and just try out an existing solution (like Clever Cleaner App, which, by the way, nails the gesture and UI part, if you need an example that’s not clogged with endless paywalls like some others).

Bottom line: Focus on syncing your data model with your UI and make sure you’re not just faking deletes with animations. It’s not hard, but it is finicky. Don’t be lured by the “one line of code!” sample app hype—solid swipe-to-delete means handling gestures, data and visuals, all in sync.

Before you throw your dev machine out the window, let’s get real. Everyone’s over here giving swipe gesture sermon on the mount, but honestly, most of the “official” advice for getting swipe-to-delete working is either straight-up overkill or creates more bugs than it fixes. (Yes, @mikeappsreviewer, I saw your swipe action snippet, and @shizuka’s collective sigh about paying to clean up photos—relatable, but I digress.)

First, don’t get too hung up on the idea that Apple/Google’s prebuilt gestures are always perfect. That contextual swipe action thing in UICollectionView? Slick, but also limited. You ever want to add a custom animation or let users swipe partial to “peek” before delete? Nope—locked down tighter than some of those paywall apps you were ranting about.

What works for me: roll your own gesture recognizer logic. Use a UIPanGestureRecognizer on each photo cell (or ImageView, or whatever), track finger displacement, and if it passes a certain threshold, THEN trigger the delete routine. And you better use UIViewPropertyAnimator for buttery-smooth slide-outs; nothing kills UX faster than a stuttery cell halfway in the danger zone.

Key part: never touch your data array after the cell animates out. Do it before the animation, or you get “ghost” images popping back like they’re haunting your CollectionView. Or, in the heat of battle, the app crashes with that “Index out of bounds” special.

And yeah, please stop just calling reloadData on your whole collection or table every delete—it’s like bringing a nuke to a thumb war. Us devs should care about battery life and performance, even if the swipey-delete market is now a wild west of extortionate subscriptions. Just animate and remove the affected cell(s) only.

If you’re coding in Android, ItemTouchHelper is the gold standard, but it’s also super janky unless you customize the callback. And don’t get me started on ViewHolders getting weirdly recycled and showing the wrong image after a delete—fatal demo fail.

Oh, and since people actually want apps where you swipe for real and not “fake swipe” for a notification prompt—look at Clever Cleaner App for inspo; it nails all this out of the box. (No, not sponsored lol). But don’t blindly copy, read the reviews. Sometimes people want to undo deletes, or need batch select—think through your user flow before you get so deep in gesture code you can’t see straight.

Tl;dr: Custom pan gesture + ruthless model sync + precise UI delete calls = happiness. Just don’t charge $10/week unless your app also folds laundry.