---
title: "componentConforming(to:)"
framework: modelio
role: symbol
role_heading: Instance Method
path: "modelio/mdlobject/componentconforming(to:)"
---

# componentConforming(to:)

Returns the object’s component for the specified protocol.

## Declaration

```swift
func componentConforming(to protocol: Protocol) -> (any MDLComponent)?
```

## Parameters

- `protocol`: The protocol for which to retrieve a component. This protocol must extend the doc://com.apple.modelio/documentation/ModelIO/MDLComponent protocol.

## Return Value

Return Value The object’s component for the protocol, or nil if the object does not have such a component.

## Discussion

Discussion Components are the basis for customizable file format and object graph support in Model I/O. By default, the MDLObject uses the MDLObjectContainerComponent and MDLTransformComponent protocols to model object hierarchies and spatial transforms: When you load an object graph from a MDLAsset instance, Model I/O creates container and transforms components to represent the object hierarchy and spatial relationships described in the asset file. However, you can also create custom components. For example, a custom component protocol could add support for an asset format that encodes gameplay-related information such as scripting triggers, or a custom class for the MDLObjectContainerComponent could implement other ways to store or traverse object hierarchies.

## See Also

### Customizing Objects with Components

- [setComponent(_:for:)](modelio/mdlobject/setcomponent(_:for:).md)
