Reorder items with Drag and Drop using SwiftUI

Reorder items with Drag and Drop using SwiftUI

Learn how to replicate UIKit’s Drag and Drop feature in the SwiftUI

·

1 min read

Earlier, we implemented a Drag and Drop feature for UICollectionView, which was used to copy the dragged item. Very useful for functionality like adding items to the cart.

Please check out the article if you’ve missed it.

Last week, we received a new requirement to provide drag and drop feature in the app for a better user experience.

According to requirements, we wanted to allow users to prioritize their activity according to their needs. While we did the implementation with UIKit in the past, we never had a chance to do it using SwiftUI.

I have divided this into 3 parts, feel free to jump around according to your needs!

  1. Create a basic UI
  2. Add drag support
  3. Add drop support and update the list

For detailed implementation, check out our blog.