---
title: "runModalOpenPanel(_:forTypes:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsdocumentcontroller/runmodalopenpanel(_:fortypes:)"
---

# runModalOpenPanel(_:forTypes:)

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

## Declaration

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

## Parameters

- `openPanel`: The open panel to display.
- `types`: An array of allowable types to open.

## Discussion

Discussion This method is called by the urlsFromRunningOpenPanel() method. It calls the 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.

## See Also

### Managing the Open Dialog

- [beginOpenPanel(completionHandler:)](appkit/nsdocumentcontroller/beginopenpanel(completionhandler:).md)
- [beginOpenPanel(_:forTypes:completionHandler:)](appkit/nsdocumentcontroller/beginopenpanel(_:fortypes:completionhandler:).md)
- [currentDirectory](appkit/nsdocumentcontroller/currentdirectory.md)
- [urlsFromRunningOpenPanel()](appkit/nsdocumentcontroller/urlsfromrunningopenpanel().md)
