The receiver’s location in the base coordinate system of the associated window.
- macOS 10.0+
For non-mouse events the return value of this method is undefined.
NSMouse and possibly other events, the event can have a
nil window (that is, the
window property contains nil). In this case,
location returns the event location in screen coordinates.
In a method of a custom view that handles mouse events, you commonly use the
location property in conjunction with the NSView method
convert(_:to get the mouse location in the view’s coordinate system. For example: