ForceTouch in macOS

Here are some handy snippets when dealing with ForceTouch in macOS:

Event handler:

Normalize the pressure:


Originally published at gist.github.com.