how do I enable Save As in File menu in SwiftUI?

The documentation here states that the saveItem command group placement contains the Save As as a default command, but it doesn't appear.

I have my document type specifying multiple 'writableContentTypes' - I expected this would enable the save as.

How do I do this?

Answered by szymczyk in 828200022

On Mac you have to hold down the Option key to make the Save As menu item appear in the File menu.

The Save As menu item is meant for saving the current document with a different file name. The menu item doesn't have anything to do with multiple content types. If you have multiple writable content types, the Save panel has a menu to choose the file type to use to save the document when you choose File > Save. You don't need the Save As menu item to specify a file type for a saved document.

Accepted Answer

On Mac you have to hold down the Option key to make the Save As menu item appear in the File menu.

The Save As menu item is meant for saving the current document with a different file name. The menu item doesn't have anything to do with multiple content types. If you have multiple writable content types, the Save panel has a menu to choose the file type to use to save the document when you choose File > Save. You don't need the Save As menu item to specify a file type for a saved document.

Thank you for your help! Is there anyway, to have that menu option permanently available? (It is a very common operation in this app, and my original AppKit native version worked this way - this is my first SwiftUI app).

The Save panel does not appear when I press Save - it does when I use Save As. It appears to be using "auto save" (I have another ticket asking how to disable this).

I don't know how to have the Save As menu appear all the time in a SwiftUI app.

The Save panel appears only the first time you save a document when choosing File > Save. After that there's no need for a Save panel when you choose File > Save because the OS knows the name and location of the document.

Understood. I see the same behavior with Pages. I guess I'll need to add an 'Export To' instead. Thanks for your help.

how do I enable Save As in File menu in SwiftUI?
 
 
Q