---
title: "init(version:lockOnSleep:useLockInterval:lockInterval:)"
framework: security
role: symbol
role_heading: Initializer
path: "security/seckeychainsettings/init(version:lockonsleep:uselockinterval:lockinterval:)"
---

# init(version:lockOnSleep:useLockInterval:lockInterval:)

Initializes a keychain settings structures with the given values.

## Declaration

```swift
init(version: UInt32, lockOnSleep: DarwinBoolean, useLockInterval: DarwinBoolean, lockInterval: UInt32)
```

## Parameters

- `version`: The keychain version. Use doc://com.apple.security/documentation/Security/SEC_KEYCHAIN_SETTINGS_VERS1.
- `lockOnSleep`: A Boolean indicating whether the keychain locks when the system enters sleep mode.
- `useLockInterval`: A Boolean indicating whether the keychain locks after an time period elapses, as given by doc://com.apple.security/documentation/Security/SecKeychainSettings/lockInterval.
- `lockInterval`: The number of seconds after which the keychain should lock if doc://com.apple.security/documentation/Security/SecKeychainSettings/useLockInterval is doc://com.apple.documentation/documentation/Swift/true.
