<!--
{
  "availability" : [
    "iOS: 18.3.0 -",
    "iPadOS: 18.3.0 -",
    "macCatalyst: 18.3.0 -",
    "macOS: 15.3.0 -",
    "tvOS: 18.3.0 -",
    "visionOS: 2.3.0 -",
    "watchOS: 11.3.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Matter",
  "identifier" : "/documentation/Matter/MTRDevice/wait(forAttributeValues:timeout:queue:completion:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Matter"
    ],
    "preciseIdentifier" : "c:objc(cs)MTRDevice(im)waitForAttributeValues:timeout:queue:completion:"
  },
  "title" : "wait(forAttributeValues:timeout:queue:completion:)"
}
-->

# wait(forAttributeValues:timeout:queue:completion:)

Sets up the provided completion to be called when any of the following
happens:

```
func wait(forAttributeValues values: [MTRAttributePath : [String : Any]], timeout: TimeInterval, queue: dispatch_queue_t, completion: @escaping ((any Error)?) -> Void) -> MTRAttributeValueWaiter
```

## Discussion

1. A set of attributes reaches certain values: completion called with nil.
2. The provided timeout expires: completion called with MTRErrorCodeTimeout error.
3. The wait is canceled: completion called with MTRErrorCodeCancelled error.

If the MTRAttributeValueWaiter is destroyed before the
completion is called, that is treated the same as canceling the waiter.

The attributes and values to wait for are represented as a dictionary which
has the attribute paths as keys and the expected data-values as values.

---

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)