---
title: "removePersistentDomain(forName:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/userdefaults/removepersistentdomain(forname:)"
---

# removePersistentDomain(forName:)

Removes the keys and values from the specified persistent domain.

## Declaration

```swift
func removePersistentDomain(forName domainName: String)
```

## Parameters

- `domainName`: The name of the domain to clear. If you specify the identifier for the argument or registration domain, this method throws an exception.

## Discussion

Discussion This method removes all of the keys and values from the specified domain. After clearing the domain’s contents, this method generates a didChangeNotification for registered observers.

## See Also

### Managing domain-specific values

- [persistentDomain(forName:)](foundation/userdefaults/persistentdomain(forname:).md)
- [setPersistentDomain(_:forName:)](foundation/userdefaults/setpersistentdomain(_:forname:).md)
- [volatileDomain(forName:)](foundation/userdefaults/volatiledomain(forname:).md)
- [setVolatileDomain(_:forName:)](foundation/userdefaults/setvolatiledomain(_:forname:).md)
- [removeVolatileDomain(forName:)](foundation/userdefaults/removevolatiledomain(forname:).md)
