You can use following code to bring your app window to focus when a specific event was triggered, e.g. a global hotkey was pressed or a tea timer has expired:
NSApp.activate(ignoringOtherApps: true)
myView?.view.window?.makeKeyAndOrderFront(self);
Problem: If this code executes while another app is the fullscreen mode, the user will be pushed back to the first desktop. This is a bad user experience because it interrupts the user.
How would I present my view just in front of the currently active fullscreen app?
The solution is the window's property
collectionBehaviourandlevel.Use the following code to display the window:
Swift 5