---
title: "setPassword(_:)"
framework: securityinterface
role: symbol
role_heading: Instance Method
path: "securityinterface/sfkeychainsavepanel/setpassword(_:)"
---

# setPassword(_:)

Specifies the password for the keychain that will be created.

## Declaration

```swift
func setPassword(_ password: String!)
```

## Parameters

- `password`: The password to be used for the new keychain.

## Discussion

Discussion This method is optional. If you don’t call this method, the keychain save panel displays a password-entry dialog.

## See Also

### Displaying a Sheet or Panel

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