Initiates a dragging session with a group of dragging items.
SDK
- macOS 10.7+
Framework
- App
Kit
Declaration
func beginDraggingSession(with items: [NSDragging Item], event: NSEvent, source: NSDragging Source) -> NSDragging Session
Parameters
items
The dragging items. The frame property of each
NSDragging
must be in the view's coordinate system.Item event
The mouse-down event object from which to initiate the drag operation. In particular, its mouse location is used for the offset of the icon being dragged.
source
An object that serves as the controller of the dragging operation. It must conform to the
NSDragging
protocol and is typically the view itself or itsSource NSWindow
object.
Return Value
The dragging session for the drag.
Discussion
A basic drag starts by calling begin
.
The caller can take the returned NSDragging
and continue to modify its properties. When the drag actually starts, the source is sent a dragging
message followed by multiple dragging
messages as the user drags.
Once the drag is ended or cancelled, the source receives a dragging
method and the drag is complete.