Class

NSDraggingItem

The NSDraggingItem class encompasses a single dragged item within an NSDraggingSession instance.

Overview

See NSDraggingSession for more information

NSDraggingItem objects have extremely limited lifetimes. Do not retain these items as changing outside of the prescribed lifetimes have no impact on the drag.

When the NSDraggingSession method beginDraggingSession(with:event:source:) is called, the dragging items passed to the method are consumed immediately and are not retained. Any further changes to the dragging item associated with the returned NSDraggingSession must be done via the enumeration method enumerateDraggingItems(options:for:classes:searchOptions:using:). When enumerating, NSDraggingItem instances are created right before being given to the enumeration Block. After returning from the Block, the NSDraggingItem instance is no longer valid.

Symbols

Initializing a Dragging Item

init(pasteboardWriter: NSPasteboardWriting)

Initializes and returns a dragging item using the specified content.

Dragging Frame

func setDraggingFrame(NSRect, contents: Any?)

Sets the item’s dragging frame and contents.

var draggingFrame: NSRect

Returns the frame of the dragging item.

Drag Image Components

var imageComponents: [NSDraggingImageComponent]?

Returns an array of dragging image components that are used to create receiver’s the drag image.

var imageComponentsProvider: (() -> [NSDraggingImageComponent])?

An array of Blocks that provide the dragging image components.

var item: Any

Returns the pasteboard reader or writer object dependent on the context of where this dragging item is used .

Relationships

Inherits From

Conforms To