Instance Method


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


optional func collectionView(_ collectionView: NSCollectionView, draggingSession session: NSDraggingSession, willBeginAt screenPoint: NSPoint, forItemsAt indexPaths: Set<IndexPath>)



The collection view notifying your delegate object.


The dragging session that is about to begin.


The starting point (in screen coordinates) for the drag operation.


The index paths of the items being dragged.


You can use this method to modify the dragging session or to perform other tasks related to the beginning of a drag session.

See Also

Drag and Drop Support

Supporting Collection View Drag and Drop Through File Promises

Share data between macOS apps during drag and drop by using an item provider.

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, namesOfPromisedFilesDroppedAtDestination: URL, forDraggedItemsAt: Set<IndexPath>) -> [String]

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

func collectionView(NSCollectionView, updateDraggingItemsForDrag: NSDraggingInfo)

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