<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/UserDefaults/DidChangeMessage",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:So14NSUserDefaultsC10FoundationE16DidChangeMessageV"
  },
  "title" : "UserDefaults.DidChangeMessage"
}
-->

# UserDefaults.DidChangeMessage

A message the system sends when a user-defaults setting changes.

```
struct DidChangeMessage
```

## Overview

When you write a new value to a setting, or remove an existing value, the system generates this message to alert you that your app’s settings changed.
Use this message in other parts of your app to incorporate updated settings.
The system posts this notification on the same thread you used to make the change.

If a different process changes your app’s settings, the system doesn’t generate this notification.
To detect changes made by another process, register a key-value observer on the [`UserDefaults`](/documentation/Foundation/UserDefaults) object.
Key-value observing reports all updates to setting values, regardless of which process made the change.

Observe this message with the identifier [`didChange`](/documentation/Foundation/NotificationCenter/MessageIdentifier/didChange-187tw), or specify its type directly to the `addObserver(of:for:using:)` method.
The [`Subject`](/documentation/Foundation/NotificationCenter/MainActorMessage/Subject) of this message type is [`UserDefaults`](/documentation/Foundation/UserDefaults).

This message interoperates with the notification [`didChangeNotification`](/documentation/Foundation/UserDefaults/didChangeNotification).
The system notifies observers of the message when the [`NotificationCenter`](/documentation/Foundation/NotificationCenter) posts the notification.
Similarly, the system notifies observers of the notification when it posts the message.

## Topics

### Creating a message

[`init()`](/documentation/Foundation/UserDefaults/DidChangeMessage/init())

Creates a message for a settings change to the user defaults.

## Relationships

### Conforms To

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`AsyncMessage`](/documentation/Foundation/NotificationCenter/AsyncMessage)

[`Sendable`](/documentation/Swift/Sendable)

---

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)