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

# objectIsForced(forKey:inDomain:)

Returns a Boolean value that indicates whether an administrator provided the value
for the key in the specified domain.

```
func objectIsForced(forKey key: String, inDomain domain: String) -> Bool
```

## Parameters

`key`

The name of the key to check.

`domain`

The domain that contains the key.

## Return Value

`true` if an administrator provides a value for the key, otherwise `false`.

## Discussion

Apps can’t change the value of managed keys, so use this method to determine if you
can make changes to a key in a specific domain. For example, you might use this
method to check for overrides of settings belonging to a shared app group. If
a key is managed, disable any app-specific UI you use to change the value of that key.

---

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)