<!--
{
  "availability" : [
    "macOS: 10.5.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSPathControlDelegate/pathControl(_:shouldDrag:with:)-35j1e",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSPathControlDelegate(im)pathControl:shouldDragPathComponentCell:withPasteboard:"
  },
  "title" : "pathControl(_:shouldDrag:with:)"
}
-->

# pathControl(_:shouldDrag:with:)

Implement this method to enable dragging from the control.

```
@MainActor optional func pathControl(_ pathControl: NSPathControl, shouldDrag pathComponentCell: NSPathComponentCell, with pasteboard: NSPasteboard) -> Bool
```

## Parameters

`pathControl`

The path control that sent the message.

`pathComponentCell`

The path component cell from which the drag is beginning.

`pasteboard`

The pasteboard.

## Discussion

This method is called when a drag is about to begin. You can refuse to allow the drag to happen by returning <doc://com.apple.documentation/documentation/Swift/false> and allow it by returning <doc://com.apple.documentation/documentation/Swift/true>. By default, the pasteboard automatically has the following types on it: `NSStringPboardType`, `NSURLPboardType` (if there is a URL value for the cell being dragged), and `NSFilenamesPboardType` (if the URL value returns <doc://com.apple.documentation/documentation/Swift/true> from -<doc://com.apple.documentation/documentation/Foundation/NSURL/isFileURL>). You can customize the types placed on the pasteboard at this time, if desired. Implementation of this method is optional.

---

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)