How can one detect when a drag is happening or a swipe on the track-pad or magic-mouse is occurring in a Mac OSX app being made in Xcode.
By drag I mean the user has clicked on the left or right edge of the window and the mouse is held down and now moving away from that side-of-the-window horizontally.
I am trying to run code on left drag or right swipe (on magic-mouse or track-pad) and another set of code on right drag or left swipe (on magic-mouse or track-pad).
Here are some definitions of the gestures that I am talking about:
A left drag is when the right side of the window is clicked and held on and the cursor moves to the left.
A right drag is when the left side of the window is clicked and held on and the cursor moves to the right.
A top drag is when the top on the window, under the frame / where the traffic-lights are, is being dragged down.
A top swipe is a swipe that starts on the top of the track-pad or magic-mouse and goes down.
In pseudo-code what I am trying to achieve is like:
if( right-drag || left-swipe ){
/*run code*/
}
else if( left-drag || right-swipe ){
/* run different code */
}
else if( top-drag || top-swipe ){
/* run other code */
}
else{
/* do nothing */
}