<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "macOS: 14.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "DockKit",
  "identifier" : "/documentation/DockKit/DockAccessoryManager/accessoryStateChanges",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "DockKit"
    ],
    "preciseIdentifier" : "s:7DockKit0A16AccessoryManagerC21accessoryStateChangesAA0aC0C0fG0Vvp"
  },
  "title" : "accessoryStateChanges"
}
-->

# accessoryStateChanges

Obtain a reference to a dock accessory and receive notifications about its state.

```
var accessoryStateChanges: DockAccessory.StateChanges { get throws }
```

## Return Value

A value that indicates the dock accessory that changed and its new state.

## Discussion

A docking or undocking notification occurs when a person docks or removes a device such as iPhone from a compatible dock accessory. The notification is a prequisite for modifying the tracking behavior of a dock accessory. For more information on controlling a dock accessory, see [`DockAccessory`](/documentation/DockKit/DockAccessory).

The following code demonstrates how to iterate through the accessory state changes to obtain the dock accessory.

```
do {
   for await accessory in try DockAccessoryManager.shared.accessoryStateChanges {
       // If this is an accessory you’re interested in, save it for later use.
   }
} catch {
   log(“Failed fetching state changes, \(error)“)
}
```

> Throws: ``doc://com.apple.DockKit/documentation/DockKit/DockKitError/notSupported`` if called on macOS.

---

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)