How to receive notifications when moving Window by mouse?

cocoa, notifications, nswindow

Solution

If You want to track `NSWindow` live moving, it's not possible by default You’ll have to do it on your own. It's possible to get notification when `NSWindow` is started to drag (move) with `NSWindowWillMoveNotification` or ended dragging (moving) - `NSWindowDidMoveNotification`.

Take a look at these examples they can help You to solve live window moving problem:

1. Example:

Description: Very short category on NSWindow that makes windows post NSWindowDidMove notifications continuously during dragging (much like NSWindowDidResizeNotification behaves). Uses a secondary thread and behavior can be toggled.

Download link.

2. Example:

Project download link.

Problem

I tried `-setFrame:display:` and `-windowDidMove:` but they are not sent while moving window.

Original source