Loading...

How to ignore mouse events in a view or window in macOS?

question macOS swift
Ram Patra Published on March 14, 2021

You can ignore mouse events in a window/view by adding just a single line of code.

window.ignoresMouseEvents = true

Or,

view.ignoresMouseEvents = true
Ram Patra Published on March 14, 2021
Image placeholder

Keep reading

If this article was helpful, others might be too

question macOS swift March 14, 2021 How to detect Escape key pressed in macOS apps?

Like Delete key, detection of Escape key press is also slightly different than detecting general key presses.

May 28, 2020 Best Mac Apps for Working From Home

For me personally, it is a mixed feeling working from home. On one hand, I have the flexibility with when to work and when not to but on the other hand, it is sometimes hard for me to find that fine line between work and life. There are days when I keep working even after office hours without realizing that I have got my life wife too :)

question macOS swift November 10, 2021 How to detect fn key press in Swift?

You can override the flagsChanged() method of NSViewController and have your code like below to detect fn key press and release in macOS: