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

# runModalOpenPanel(_:forTypes:)

Presents a modal Open dialog and limits selection to specific file types.

```
func runModalOpenPanel(_ openPanel: NSOpenPanel, forTypes types: [String]?) -> Int
```

## Parameters

`openPanel`

The open panel to display.

`types`

An array of allowable types to open.

## Discussion

This method is called by the [`urlsFromRunningOpenPanel()`](/documentation/AppKit/NSDocumentController/urlsFromRunningOpenPanel()) method. It calls the `NSOpenPanel` [`runModalForTypes:`](/documentation/AppKit/NSOpenPanel/runModalForTypes:) method, passing the `openPanel` object and the file extensions associated with a document type. The `extensions` parameter may also contain encoded HFS file types as well as filename extensions.

---

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)