Instance Property


Specifies the number of valid items for a drop operation.



var numberOfValidItemsForDrop: Int { get set }


During draggingEntered: or draggingUpdated:, you are responsible for returning the drag operation. In some cases, you may accept some, but not all items on the dragging pasteboard. (For example, your application may only accept image files.)

If you only accept some of the items, set this property to the number of items accepted so the drag manager can update the drag count badge.

When updateDraggingItemsForDrag(_:) is called, you should set the image of non-valid dragging items to nil. If none of the drag items are valid then you should not updateItems:, simply return none from your implementation of draggingEntered: and, or draggingUpdated: and do not modify any drag item properties.

See Also

Obtaining Information About the Dragging Session

var draggingPasteboard: NSPasteboard

Returns the pasteboard object that holds the data being dragged.


var draggingSequenceNumber: Int

Returns a number that uniquely identifies the dragging session.


var draggingSource: Any?

Returns the source, or owner, of the dragged data.


var draggingSourceOperationMask: NSDragOperation

Returns the dragging operation mask of the dragging source.


var draggingLocation: NSPoint

Returns the current location of the mouse pointer in the base coordinate system of the destination object’s window.


var draggingDestinationWindow: NSWindow?

Returns the destination window for the dragging operation.


func namesOfPromisedFilesDropped(atDestination: URL) -> [String]?

Sets the drop location for promised files and returns the names of the files that the receiver promises to create there.