<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/UserDefaults/persistentDomain(forName:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSUserDefaults(im)persistentDomainForName:"
  },
  "title" : "persistentDomain(forName:)"
}
-->

# persistentDomain(forName:)

Retrieves the settings from the specified persistent domain.

```
func persistentDomain(forName domainName: String) -> [String : Any]?
```

## Parameters

`domainName`

The name of the persistent domain. Specify your app’s bundle identifier
to retrieve any app-specific keys. Specify the [`globalDomain`](/documentation/Foundation/UserDefaults/globalDomain) identifier to
retrieve keys in the global domain.

## Return Value

A dictionary containing the keys and values from the specified domain. If
the domain doesn’t contain any keys, or is a volatile domain, the method returns `nil`.

## Discussion

This method retrieves only the keys and values from the specified domain. It doesn’t
retrieve keys from other persistent or volatile domains.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)