1
votes

Like Safari app, in a macOS Swift project I would like to let users to open more than a window and possibly use tabbed browsing to switch from a window to another. The app starts with a blank window and don't need to save or open documents.

A Document Based application seems perfect to me for handle more than a window but I don't want users have to handle documents. How can I disable or hide, if possible, the Open and Save document features?

Edit: if possible, I would like to disable this popup also:

enter image description here

2

2 Answers

0
votes

It is very simple - just remove (delete) the Open, Open Recent..., Save, Save as... menu items from the menu XIB. If you don't want a title bar, simply untick the "Title" checkbox for the window in the XIB, though that makes the window difficult to move.

enter image description here

If you have a title bar, to override "Untitled", you could

override var displayName: String! {
    get {
        return "Anything you like, even \"\""
    }
    set {

    }
}

however that would still allow access to the save as menu through the chevron. To suppress that, you need an NSWindowDelegate Docs

window(_:shouldPopUpDocumentPathMenu:) Asks the delegate whether the window displays the title pop-up menu in response to a Command-click or Control-click on its title.

0
votes

Just add autosavesInPlace at true