fredsco
fredsco

Reputation: 333

Swift NSWindow fixed position

I am creating an OSX App in Swift.

What I want is: when I press the icon in the mac top bar I want the window to be exactly underneath the icon like most preferences app do.

Thanks,

Upvotes: 0

Views: 285

Answers (1)

Jonas
Jonas

Reputation: 2259

You can get the position of the mouse when the user clicks the statusbar and then you know where you can put your window:

NSEvent.mouseLocation()

Upvotes: 1

Related Questions