<!--
{
  "availability" : [
    "macOS: 10.7.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSView/beginDraggingSession(with:event:source:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSView(im)beginDraggingSessionWithItems:event:source:"
  },
  "title" : "beginDraggingSession(with:event:source:)"
}
-->

# beginDraggingSession(with:event:source:)

Initiates a dragging session with a group of dragging items.

```
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 [`NSDraggingSource`](/documentation/AppKit/NSDraggingSource) protocol and is typically the view itself or its [`NSWindow`](/documentation/AppKit/NSWindow) object.

## Return Value

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

## Discussion

A basic drag starts by calling `beginDraggingSessionWithItems:event:source:`.

The caller can take the returned [`NSDraggingSession`](/documentation/AppKit/NSDraggingSession) and continue to modify its properties. When the drag actually starts, the source is sent a [`draggingSession(_:willBeginAt:)`](/documentation/AppKit/NSDraggingSource/draggingSession(_:willBeginAt:)) message followed by multiple [`draggingSession(_:movedTo:)`](/documentation/AppKit/NSDraggingSource/draggingSession(_:movedTo:)) messages as the user drags.

Once the drag is ended or cancelled, the source receives a [`draggingSession(_:endedAt:operation:)`](/documentation/AppKit/NSDraggingSource/draggingSession(_:endedAt:operation:)) method and the drag is complete.

## See Also

[`dragImage:at:offset:event:pasteboard:source:slideBack:`](/documentation/AppKit/NSView/dragImage:at:offset:event:pasteboard:source:slideBack:)

Initiates a dragging operation from the view, allowing the user to drag arbitrary data with a specified icon into any application that has window or view objects that accept dragged data.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)