---
title: "SecKeychainGetPreferenceDomain(_:)"
framework: security
role: symbol
role_heading: Function
path: "security/seckeychaingetpreferencedomain(_:)"
---

# SecKeychainGetPreferenceDomain(_:)

Gets the current keychain preference domain.

## Declaration

```swift
func SecKeychainGetPreferenceDomain(_ domain: UnsafeMutablePointer<SecPreferencesDomain>) -> OSStatus
```

## Parameters

- `domain`: On return, a pointer to the keychain preference domain. See doc://com.apple.security/documentation/Security/SecPreferencesDomain for possible domain values.

## Return Value

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

## Discussion

Discussion A preference domain is a set of security-related preferences, such as the default keychain and the current keychain search list. The default preference domain for system daemons (that is, for daemons running in the root session) is the system domain. The default preference domain for all other programs is the user domain. Use the SecKeychainSetPreferenceDomain(_:) function to change the preference domain.
