Instance Property

allowedFileTypes

An array of NSString objects specifying the allowed file types for the panel.

Declaration

@property(copy) NSArray<NSString *> *allowedFileTypes;

Discussion

The value of this property specifies the file types the user can save the file as. A file type can be a common file extension, or a UTI. The default value of this property is nil, which indicates that any file type can be used. (Note that if the array is not nil and the array contains no items, an exception is raised.)

If no extension is given by the user, the first item in the allowedFileTypes array will be used as the extension for the save panel. If the user specifies a type not in the array, and allowsOtherFileTypes is YES, they will be presented with another dialog when prompted to save.

NSOpenPanel: In versions of macOS earlier than v10.6, this property is ignored. For applications that link against v10.6 and higher, this property determines which files should be enabled in the open panel. You should not use the deprecated methods to show the open panel (that is, the methods that take a types: parameter) because they will overwrite this value. The allowed file types can be changed while the panel is running (for example, from an accessory view). This is also known as the “enabled file types.” A nil value indicates that all files should be enabled.

See Also

Configuring Panel Content

extensionHidden

A Boolean value that indicates whether the extension-hiding checkbox is visible and checked.

- requiredFileType

Returns the required file type (if any).

Deprecated
- setRequiredFileType:

Specifies the file type (as an extension) or a UTI.

Deprecated
directoryURL

The directory shown in the panel as a URL.

- setDirectory:

Sets the current pathname in the panel’s browser.

Deprecated
canSelectHiddenExtension

A Boolean value that indicates whether the panel allows the user to hide or show file extensions.

allowsOtherFileTypes

A Boolean value that indicates whether the panel allows the user to save files with an extension that’s not in the list of allowed types.

treatsFilePackagesAsDirectories

A Boolean value that indicates whether the panel displays file packages as directories.