Validates whether a drop operation is possible at the specified location.
- macOS 10.11+
The collection view asking you to validate the drop operation.
The information about the drag operation.
The index path at which the drop would occur. This parameter is passed by-reference and can be modified to change the proposed index path.
The type of drop operation being proposed. This parameter is passed by-reference and can be modified to change the drop operation type.
A value that indicates which dragging operation to perform. Return
none to disallow a drop at the proposed location.
Although implementation of this method is optional, you must implement it to support drops onto the associated collection view. You must also call the collection view’s
register method to register the types of drops it supports. If you do not perform both of these actions, the collection view does not accept drops.
When an interactive drag operation occurs, the collection view calls this method to determine whether the current mouse location is a valid place to drop the content. This method may be called many times during the course of the drag operation. Your implementation should look at the proposed location and return a constant that reflects how the drop would be handled.
While validating the drop location, you can suggest a better drop location by updating the values in the
proposed parameters. For example, you might suggest dropping the content before the specified item instead of on it. The collection view sets the
proposed parameter to
NSCollection when the mouse is closer to the middle of an item than to its edges; otherwise, it sets the parameter to