O'Reilly logo

Cocoa Programming for OS X: The Big Nerd Ranch Guide by Aaron Hillegass, Adam Preble, Nate Chandler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

For the More Curious: Operation Mask

For some apps, the negotiation of what operation will occur when the user drops can be quite complicated. After all, the source advertises its willingness to participate in some kinds of operations through draggingSession(_:sourceOperationMaskForDraggingContext:). The user may also indicate preferences by holding down the Control, Option, or Command key. It is the job of the destination to determine what happens.

The dragging info object will do most of the work for you. It will get the source’s advertised operation mask and filter it, depending on what modifier keys the user holds down. To see this, implement draggingUpdated(_:) and log out the dragging info’s operation mask:

 ​ ​ ​ ​o​v​e​r​r​i​d​e​ ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required