Drag and drop
Bring drag and drop to your app by using interaction APIs with your views.
Overview
With drag and drop in iOS, users can drag items from one onscreen location to another using continuous gestures. A drag-and-drop activity can take place in a single app, or it can start in one app and end in another.
The app from which an item is dragged is the source app. The app on which an item is dropped is the destination app. For drag and drop in a single app, that app plays both roles simultaneously. The complete user action from start to finish — using system-mediated gestures — is a drag activity. A drag session, by contrast, is an object that’s managed by the system and that manages the items the user is dragging.
When dragging is in progress, the source and destination apps continue to run normally and support user interaction. A user can invoke the Dock, return to the Home screen, open a second app in Split View, and even start another drag activity.
Unlike in macOS, iOS drag and drop supports multiple simultaneous drag activities—as many as the user’s fingers can handle. You can design your app so that the user can sequentially add drag items to an in-progress drag session, and a destination app can accept multiple, simultaneous drops.
Text views and text fields automatically support drag and drop. Collection views and table views offer dedicated, view-specific methods and properties, and text views offer APIs for customizing the views’ drag-and-drop behavior. You can configure any custom view to support drag and drop.
Topics
Essentials
Understanding a drag item as a promiseMaking a view into a drag sourceMaking a view into a drop destinationAdopting drag and drop in a custom viewAdopting drag and drop in a table view
Drag and drop interactions
Spring-loaded interactions
UISpringLoadedInteractionBehaviorUISpringLoadedInteractionSupportingUISpringLoadedInteractionUISpringLoadedInteractionContextUISpringLoadedInteractionEffect
Drag sources
Drop destinations
Item providers
Data delivery with drag and dropNSItemProviderNSItemProviderReadingNSItemProviderWritingUIItemProviderPresentationSizeProvidingUIItemProviderReadingAugmentationDesignatingUIItemProviderReadingAugmentationProviding