<!--
{
  "availability" : [
    "macOS: 10.0.0 - 10.13.0"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSView/dragPromisedFiles(ofTypes:from:source:slideBack:event:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSView(im)dragPromisedFilesOfTypes:fromRect:source:slideBack:event:"
  },
  "title" : "dragPromisedFiles(ofTypes:from:source:slideBack:event:)"
}
-->

# dragPromisedFiles(ofTypes:from:source:slideBack:event:)

Initiates a dragging operation from the view, allowing the user to drag one or more promised files (or directories) into any application that has window or view objects that accept promised file data.

```
func dragPromisedFiles(ofTypes typeArray: [String], from rect: NSRect, source sourceObject: Any, slideBack flag: Bool, event: NSEvent) -> Bool
```

## Parameters

`typeArray`

An array of file types being promised. The array elements can consist of file extensions and HFS types encoded with the <doc://com.apple.documentation/documentation/Foundation/NSFileTypeForHFSTypeCode(_:)> function. If promising a directory of files, only include the top directory in the array.

`rect`

A rectangle that describes the position of the icon in the view’s coordinate system.

`sourceObject`

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.

`flag`

A Boolean that indicates whether the icon being dragged should slide back to its position in the view if the file isn’t accepted. The icon slides back to `aRect` if `slideBack` is <doc://com.apple.documentation/documentation/Swift/true>, the promised files are not accepted by the dragging destination, and the user has not disabled icon animation; otherwise it simply disappears.

`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.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the drag operation is initiated successfully, <doc://com.apple.documentation/documentation/Swift/false> otherwise.

## Discussion

This method must be invoked only within an implementation of the [`mouseDown(with:)`](/documentation/AppKit/NSResponder/mouseDown(with:)) method. As part of its implementation, this method invokes [`dragImage:at:offset:event:pasteboard:source:slideBack:`](/documentation/AppKit/NSView/dragImage:at:offset:event:pasteboard:source:slideBack:).

Promised files are files that do not exist, yet, but that the drag source, `sourceObject`, promises to create at a file system location specified by the drag destination when the drag is successfully dropped.

See [Drag and Drop](/documentation/AppKit/drag-and-drop) for more information on dragging operations.

## See Also

[`-  unregisterDraggedTypes`](/documentation/AppKit/NSView/unregisterDraggedTypes())

Unregisters the view as a possible destination in a dragging session.

[`-  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.

[`-  registerForDraggedTypes:`](/documentation/AppKit/NSView/registerForDraggedTypes(_:))

Registers the pasteboard types that the view will accept as the destination of an image-dragging session.

[`-  shouldDelayWindowOrderingForEvent:`](/documentation/AppKit/NSView/shouldDelayWindowOrdering(for:))

Allows the user to drag objects from the view without activating the app or moving the window of the view forward, possibly obscuring the destination.

[`-  beginDraggingSessionWithItems:event:source:`](/documentation/AppKit/NSView/beginDraggingSession(with:event:source:))

Initiates a dragging session with a group of dragging items.



---

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)