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
Presentify

Take your presentation to the next level.

FaceScreen

Put your face and name on your screen.

ToDoBar

Your to-dos on your menu bar.

Ram Patra Published on March 14, 2021
Image placeholder

Keep reading

If this article was helpful, others might be too

question macOS swift August 6, 2020 How to open an app's window on top of all others in Swift?

You can open your app’s window on top of all other open application windows with the below code:

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:

question macOS swift August 14, 2020 How to detect Delete key press in Swift?

Delete key press detection is slightly different than other keys. It uses NSDeleteCharacter like below: