Instance Method


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


optional func collectionView(_ collectionView: NSCollectionView, namesOfPromisedFilesDroppedAtDestination dropURL: URL, forDraggedItemsAt indexPaths: Set<IndexPath>) -> [String]



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


The URL at which to create the promised files.


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.


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 namesOfPromisedFilesDropped(atDestination:) 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

func collectionView(NSCollectionView, canDragItemsAt: Set<IndexPath>, with: NSEvent) -> Bool

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

func collectionView(NSCollectionView, pasteboardWriterForItemAt: IndexPath) -> NSPasteboardWriting?

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

func collectionView(NSCollectionView, writeItemsAt: Set<IndexPath>, to: NSPasteboard) -> Bool

Places the data for the drag operation on the pasteboard.

func collectionView(NSCollectionView, updateDraggingItemsForDrag: NSDraggingInfo)

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