NSWindow controlling multiple tabs

960 views Asked by At

What is the best way to achieve multiple tab control within a single NSWindow akin to the Terminal App?

enter image description here

The existing TabView & TabViewController don't seem to be able to achieve this but I'm not sure.

My first thought was to use a collection view but I'm afraid to start re-inventing something already done.

1

There are 1 answers

1
Léo Natan On BEST ANSWER

That's actually a magic that the operating system does for you with multiple windows.

You set the tabbingMode of your window and a tabbingIdentifier if needed. From there, the system will handle your tabbing needs. You create separate windows. If you want to force tabbing in your application, use the addTabbedWindow:ordered: API.

You also get the "new tab" and "view all tabs" functionality for free.