A Xcode window in all spaces

(Swift and macOS)


I have a window that I would like to be in all the spaces. One option would be that the window could change when the user goes to another space.


I could find that in the documentation: https://developer.apple.com/documentation/appkit/nswindow/1419707-isonactivespace


I am not sure how to implement it. This is what I tried. It does not work:


override func viewDidLoad() {

super.viewDidLoad()

self.view.window?.collectionBehavior = NSWindow.CollectionBehavior.canJoinAllSpaces

self.view.window?.collectionBehavior = NSWindow.CollectionBehavior.moveToActiveSpace

}


Should I do anything else, anything different?


Thank you

Replies

That may be an old answer, but have a look here:


https://stackoverflow.com/questions/35461347/programmatically-open-nswindow-in-another-desktop-space


That does not seem possible:

quote: "I contact Apple DTS and they told me: Our engineers have reviewed your request and have concluded that there is no supported way to achieve the desired functionality given the currently shipping system configurations"