November Rain November Rain - 1 year ago 78
Swift Question

Create a fixed position window in Mac Application development

I'm new in Mac Application development. I want to create a small tool which having a small window fixed position at the right bottom of the screen like this picture:

enter image description here

Is it possible to do that?

Answer Source

It's possible - but I wouldn't recommend it, as it could be a bad user experience.

The solution is simple, though: set the .isMovable property of the window to false.

For example, for a window IBOutlet, setting:

window.isMovable = false

in applicationDidFinishLaunching works well.

You can also, for example, use window.setFrameOrigin(_ point: NSPoint) to first set it at a fixed position.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download