title: Swift on OS X. How to handle global mouse events?
body: <p>I am new to Swift and Xcode and I have next problem:</p>
  
  <p>I have simple Cocoa Swift Application with one counter (<code>Label</code>). 
  <a href="https://i.stack.imgur.com/kbuEW.png" rel="noreferrer"><img src="https://i.stack.imgur.com/kbuEW.png" alt="enter image description here"></a></p>
  
  <p><strong>How to handle all mouse clicks in my Mac (in all applications) and display it in my <code>Label</code>?</strong></p>
  
  <p>I use Xcode 7.3.1.</p>
  
  <p><strong>UPDATE 1.</strong> What I have already found it's <a href="https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/EventOverview/MonitoringEvents/MonitoringEvents.html" rel="noreferrer">Monitoring Events</a> and <code>addGlobalMonitorForEventsMatchingMask:handler:</code> function in Cocoa, but I'm not sure that I'm on the right way.</p>