'Config application's titlebar width to some values [duplicate]

Firstly, I want to show my code to config my application's titlebar:

    let customToolbar = NSToolbar()
    customToolbar.showsBaselineSeparator = false
    window?.toolbar = customToolbar
    window?.titleVisibility = .hidden
    window?.titlebarAppearsTransparent = true

This is the result: enter image description here

However, the title bar's width is still spanning through all application's width. I want to make it narrows to some area only. For example, Apple Music's interface

enter image description here

In the Apple's Music case, it looks like toolbar and titlebar is on the same row.

How can I do this in SwiftUI 1.0?

My apologies because I don't know to express the problem better. I am happy to add more information in case I missed something.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source