---
title: UserDefaults.DidChangeMessage
framework: foundation
role: symbol
role_heading: Structure
path: foundation/userdefaults/didchangemessage
---

# UserDefaults.DidChangeMessage

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

## Declaration

```swift
struct DidChangeMessage
```

## Mentioned in

Accessing settings from your code

## Overview

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 object. Key-value observing reports all updates to setting values, regardless of which process made the change. Observe this message with the identifier didChange, or specify its type directly to the addObserver(of:for:using:) method. The Subject of this message type is UserDefaults. This message interoperates with the notification didChangeNotification. The system notifies observers of the message when the NotificationCenter posts the notification. Similarly, the system notifies observers of the notification when it posts the message.

## Topics

### Creating a message

- [init()](foundation/userdefaults/didchangemessage/init().md)

## Relationships

### Conforms To

- [NotificationCenter.AsyncMessage](foundation/notificationcenter/asyncmessage.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Monitoring settings changes and issues

- [didChangeNotification](foundation/userdefaults/didchangenotification.md)
- [UserDefaults.SizeLimitExceededMessage](foundation/userdefaults/sizelimitexceededmessage.md)
- [sizeLimitExceededNotification](foundation/userdefaults/sizelimitexceedednotification.md)
