You can open your app’s window on top of all other open application windows with the below code:
windowController?.showWindow(self)
NSApp.activate(ignoringOtherApps: true)
For example, in my app––Presentify––when you click on ‘Preferences’, the Settings window opens up on top of all other
applications. With just windowController?.showWindow(self), the window would open fine, but it won’t be visible to the
user if other apps are open.