I would like to provide a default filename when saving a document depending on the document data. I thought I could do so by overriding NSDocument.prepareSavePanel(_:)
and setting NSSavePanel.nameFieldStringValue
, but simply implementing that method seems to hide the file format popup button shown by default (see image). Calling super
doesn't help.
Is it possible to set a default filename and keep the file format popup button? On macOS 15, I can toggle NSSavePanel.showsContentTypes
, but how about macOS 14 and older?
Have you enabled the allowsOtherFileTypes option for the NSSavePanel? Reviewing the NSDocument sources I can see those sources are aware of that option and gate some operations based on its setting.