<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RoomPlan",
  "identifier" : "/documentation/RoomPlan/CapturedRoom/Object/attribute(of:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "RoomPlan"
    ],
    "preciseIdentifier" : "s:8RoomPlan08CapturedA0V6ObjectV9attribute2ofxSgxm_tAA0cA9AttributeRzlF"
  },
  "title" : "attribute(of:)"
}
-->

# attribute(of:)

Checks an object for specific attribute types.

```
func attribute<T>(of attributeType: T.Type) -> T? where T : CapturedRoomAttribute
```

## Discussion

This function provides details about an object based on attribute type. For example, the following code checks whether an object the framework observes during a scan resembles a dining table:

```swift
let chairType = object.attribute(of: ChairType.self)
if chairType == .dining { /* ... */ }
```

---

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)