<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: 13.1.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIDropInteractionDelegate/dropInteraction(_:performDrop:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UIDropInteractionDelegate(im)dropInteraction:performDrop:"
  },
  "title" : "dropInteraction(_:performDrop:)"
}
-->

# dropInteraction(_:performDrop:)

Tells the delegate it can request the item provider data from the session’s drag items.

```
optional func dropInteraction(_ interaction: UIDropInteraction, performDrop session: any UIDropSession)
```

## Parameters

`interaction`

The interaction that called this method.

`session`

The session containing the drag items.

## Discussion

You can request a drag item’s [`itemProvider`](/documentation/UIKit/UIDragItem/itemProvider) data within the scope of this method only and not at any other time.

To request the data, iterate over the session items calling <doc://com.apple.documentation/documentation/Foundation/NSItemProvider/loadObject(ofClass:completionHandler:)-8ak5d> on each item’s item provider. For example, if you are expecting the drag items to be images, here’s how you can load each image:

```swift
func dropInteraction(_ interaction: UIDropInteraction, performDrop session: UIDropSession) {
    for item in session.items {
        let itemProvider = item.itemProvider
        guard itemProvider.canLoadObject(ofClass: UIImage.self) 
        else {continue}

        itemProvider.loadObject(ofClass: UIImage.self, completionHandler: { (object, error) in
            if let image = object as? UIImage {
                DispatchQueue.main.async {
                    self.imageView.image = image
                }
            }
        })
    }
}
```

If you need to be more specific about the type of data to load, use one of the following methods to specify the desired data type using its uniform type identifier (UTI):

- <doc://com.apple.documentation/documentation/Foundation/NSItemProvider/loadDataRepresentation(forTypeIdentifier:completionHandler:)>
- <doc://com.apple.documentation/documentation/Foundation/NSItemProvider/loadFileRepresentation(forTypeIdentifier:completionHandler:)>
- <doc://com.apple.documentation/documentation/Foundation/NSItemProvider/loadInPlaceFileRepresentation(forTypeIdentifier:completionHandler:)>

If you want only JPEG images, use the UTI for the JPEG image type:

```swift
import MobileCoreServices // for kUTTypeJPEG
func dropInteraction(_ interaction: UIDropInteraction, performDrop session: UIDropSession) {
    for item in session.items {
        let itemProvider = item.itemProvider
        itemProvider.loadDataRepresentation(forTypeIdentifier: kUTTypeJPEG as String, completionHandler: { (data, error) in
            guard
                let data = data,
                let image = UIImage(data: data)
                else {return}
            
            DispatchQueue.main.async {
                self.imageView.image = image
            }        
        })
    }
}
```

You can also use the session’s convenience method [`loadObjects(ofClass:completion:)`](/documentation/UIKit/UIDropSession/loadObjects(ofClass:completion:)) to load the data for an item. Note that the completion handler for this method is called on the main thread, which is not true when loading the data from the item provider.

```swift
func dropInteraction(_ interaction: UIDropInteraction, performDrop session: UIDropSession) {
    session.loadObjects(ofClass: UIImage.self) { objects in
        guard let images = objects as? [UIImage] else {return}
        for image in images {
            self.imageView.image = image
        }
    }
}
```

When you ask the session or item provider to load its data, it gives you a <doc://com.apple.documentation/documentation/Foundation/Progress> object. You can also get the progress for the session at a later time from its <doc://com.apple.documentation/documentation/Foundation/ProgressReporting/progress> property.

The <doc://com.apple.documentation/documentation/Foundation/Progress> object tells you how much of the data transfer is complete and if the transfer has finished. What’s more, it can be used to cancel, pause, and resume the data-load process.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)