Issue #899
Use NSTitlebarAccessoryViewController
var titleBarAccessoryVC: NSTitlebarAccessoryViewController {
let vc = NSTitlebarAccessoryViewController()
let view = HStack {
Spacer()
Button {
} label: {
Text("Save")
}
.buttonStyle(.borderedProminent)
.controlSize(.large)
}
.padding(.horizontal)
vc.view = NSHostingView(rootView: view)
return vc
}
let window: NSWindow = ...
window.addTitlebarAccessoryViewController(titleBarAccessoryVC)