---
title: accessoryStateChanges
framework: dockkit
role: symbol
role_heading: Instance Property
path: dockkit/dockaccessorymanager/accessorystatechanges
---

# accessoryStateChanges

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

## Declaration

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

## Mentioned in

Modify rotation and positioning programmatically

## Return Value

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

## Discussion

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. 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)“) } note: DockKitError.notSupported if called on macOS.
