Contents

attribute(of:)

Checks an object for specific attribute types.

Declaration

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:

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

See Also

Describing an object