---
title: "runModal(forDirectory:file:)"
framework: securityinterface
role: symbol
role_heading: Instance Method
path: "securityinterface/sfkeychainsavepanel/runmodal(fordirectory:file:)"
---

# runModal(forDirectory:file:)

Displays a panel that allows a user to create a new keychain.

## Declaration

```swift
func runModal(forDirectory path: String!, file name: String!) -> Int
```

## Parameters

- `path`: The path to the folder where the keychain is created. Specify nil for ~/Library/Keychains.
- `name`: The keychain name to be automatically displayed in the Save As field of the panel.

## Discussion

Discussion This method returns a result code from the runModalForDirectory:file:types: method of the NSSavePanel class: NSFileHandlingPanelOKButton if the user clicks the OK button or NSFileHandlingPanelCancelButton if the user clicks the Cancel button. Use the keychain() method to obtain the keychain created by the user.

## See Also

### Displaying a Sheet or Panel

- [setPassword(_:)](securityinterface/sfkeychainsavepanel/setpassword(_:).md)
- [beginSheet(forDirectory:file:modalFor:modalDelegate:didEnd:contextInfo:)](securityinterface/sfkeychainsavepanel/beginsheet(fordirectory:file:modalfor:modaldelegate:didend:contextinfo:).md)
