Instance Method

collectionView:namesOfPromisedFilesDroppedAtDestination:forDraggedItemsAtIndexPaths:

Returns the names of the promised files that you created for a drag operation.

Declaration

- (NSArray<NSString *> *)collectionView:(NSCollectionView *)collectionView namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropURL forDraggedItemsAtIndexPaths:(NSSet<NSIndexPath *> *)indexPaths;

Parameters

collectionView

The collection view asking you to provide the list of filenames.

dropURL

The URL at which to create the promised files.

indexPaths

The index paths of the dragged items.

Return Value

An array of strings containing the filenames you created, or intend to create, at the specified URL.

Discussion

At the start of a drag operation, your app must provide the data that constitutes the items being dragged. If you specify a file promise, instead of the data itself, use this method to specify the names of the files you promised. If the files already exist, move them to the directory specified by the dropURL parameter. If you must create the files first, use this method to specify the names of the files you intend to provide and begin creating those files asynchronously on a background thread.

The filenames you return are made available from the namesOfPromisedFilesDroppedAtDestination: method of the NSDraggingInfo object passed around during the drag operation.

For more information about how to use file promises when dragging content, see Drag and Drop Programming Topics.

See Also

Drag and Drop Support

- collectionView:canDragItemsAtIndexPaths:withEvent:

Returns a Boolean indicating whether a drag operation involving the specified items can begin.

- collectionView:pasteboardWriterForItemAtIndexPath:

Provides the pasteboard writer for the item at the specified index path.

- collectionView:writeItemsAtIndexPaths:toPasteboard:

Places the data for the drag operation on the pasteboard.

Deprecated
- collectionView:draggingImageForItemsAtIndexPaths:withEvent:offset:

Creates and returns a drag image to represent the specified items during a drag.

- collectionView:draggingSession:willBeginAtPoint:forItemsAtIndexPaths:

Notifies your delegate that a drag session is about to begin.

- collectionView:draggingSession:endedAtPoint:dragOperation:

Notifies your delegate that a drag session ended.

- collectionView:updateDraggingItemsForDrag:

Asks your delegate to update the dragging items during a drag operation.

- collectionView:validateDrop:proposedIndexPath:dropOperation:

Validates whether a drop operation is possible at the specified location.

- collectionView:acceptDrop:indexPath:dropOperation:

Incorporates the dropped content into the collection view.