---
title: "beginDraggingSession(with:event:source:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsview/begindraggingsession(with:event:source:)"
---

# beginDraggingSession(with:event:source:)

Initiates a dragging session with a group of dragging items.

## Declaration

```swift
func beginDraggingSession(with items: [NSDraggingItem], event: NSEvent, source: any NSDraggingSource) -> NSDraggingSession
```

## Parameters

- `items`: The dragging items. The frame property of each NSDraggingItem must be in the view’s coordinate system.
- `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 doc://com.apple.appkit/documentation/AppKit/NSDraggingSource protocol and is typically the view itself or its doc://com.apple.appkit/documentation/AppKit/NSWindow object.

## Return Value

Return Value The dragging session for the drag, , or nil if the method can’t start the session.

## Discussion

Discussion A basic drag starts by calling beginDraggingSessionWithItems:event:source:. The caller can take the returned NSDraggingSession and continue to modify its properties. When the drag actually starts, the source is sent a draggingSession(_:willBeginAt:) message followed by multiple draggingSession(_:movedTo:) messages as the user drags. Once the drag is ended or cancelled, the source receives a draggingSession(_:endedAt:operation:) method and the drag is complete.

## See Also

### Dragging Operations

- [registerForDraggedTypes(_:)](appkit/nsview/registerfordraggedtypes(_:).md)
- [unregisterDraggedTypes()](appkit/nsview/unregisterdraggedtypes().md)
- [registeredDraggedTypes](appkit/nsview/registereddraggedtypes.md)
- [beginDraggingSession(items:gesture:source:)](appkit/nsview/begindraggingsession(items:gesture:source:).md)
- [shouldDelayWindowOrdering(for:)](appkit/nsview/shoulddelaywindowordering(for:).md)
