<!--
{
  "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/volatileDomain(forName:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSUserDefaults(im)volatileDomainForName:"
  },
  "title" : "volatileDomain(forName:)"
}
-->

# volatileDomain(forName:)

Retrieves the settings from the specified volatile domain.

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

## Parameters

`domainName`

The name of the volatile domain. For example, specify the
[`argumentDomain`](/documentation/Foundation/UserDefaults/argumentDomain) identifier to retrieve the command-line settings.

## Return Value

A dictionary containing the keys and values from the specified domain. If the
domain doesn’t contain any keys, or is a persistent domain, this 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)