问题
I want to add the tabbing mechanism that you can see e.g. in Safari, the Console or the Finder (http://dailymactips.com/working-with-finder-tabs-on-your-mac/). I have already searched a lot, but I can not find a good guide for this.
Ideally, I want to be able to push an alert-dialog before a new tab is created by the user.
回答1:
NSWindow has native tabs for a couple of years now.
The "Whats new in Cocoa" session from WWDC 2016 is the best place to start, since the documentation is quite thin still.
Whats New In Cocoa (203 WWDC 2016)
If you are using (for example) the method addTabbedWindow::ordered:, you can simply show your alert before adding the tab.
来源:https://stackoverflow.com/questions/48830321/macos-swift-safari-like-tabs