<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSDocument/writableTypes(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSDocument(im)writableTypesForSaveOperation:"
  },
  "title" : "writableTypes(for:)"
}
-->

# writableTypes(for:)

Returns the names of the types to which this document can be saved for a specified kind of save operation.

```
nonisolated func writableTypes(for saveOperation: NSDocument.SaveOperationType) -> [String]
```

## Parameters

`saveOperation`

The kind of save operation.

## Return Value

An array of `NSString` objects representing the writable document types.

## Discussion

The save operation type is represented by `saveOperation`. For every kind of save operation except `NSSaveToOperation`, the returned array must only include types for which the app can play the Editor role. For `NSSaveToOperation` the returned array may include types for which the app can only play the Viewer role, and other types that the app can merely export. The default implementation of this method returns `[[self class] writableTypes]` with, except during `NSSaveToOperation`, types for which [`isNativeType(_:)`](/documentation/AppKit/NSDocument/isNativeType(_:)) returns <doc://com.apple.documentation/documentation/Swift/false> filtered out.

You can override this method to limit the set of writable types when the document currently contains data that is not representable in all types. For example, you can disallow saving to RTF files when the document contains an attachment and can only be saved properly to RTFD files.

You can invoke this method when creating a custom save panel accessory view to present easily the same set of types as `NSDocument` does in its standard file format popup menu.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)