---
title: "SecKeychainSetSettings(_:_:)"
framework: security
role: symbol
role_heading: Function
path: "security/seckeychainsetsettings(_:_:)"
---

# SecKeychainSetSettings(_:_:)

Changes the settings of a keychain.

## Declaration

```swift
func SecKeychainSetSettings(_ keychain: SecKeychain?, _ newSettings: UnsafePointer<SecKeychainSettings>) -> OSStatus
```

## Parameters

- `keychain`: A reference to a keychain whose settings you wish to change. Pass NULL to change the settings of the default keychain.
- `newSettings`: A pointer to a keychain settings structure that defines whether the keychain locks when sleeping, or locks after a set time period of inactivity.

## Return Value

Return Value A result code. See Security Framework Result Codes.
