<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "ModelIO",
  "identifier" : "/documentation/ModelIO/MDLObject/componentConforming(to:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Model I/O"
    ],
    "preciseIdentifier" : "c:objc(cs)MDLObject(im)componentConformingToProtocol:"
  },
  "title" : "componentConforming(to:)"
}
-->

# componentConforming(to:)

Returns the object’s component for the specified protocol.

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

## Parameters

`protocol`

The protocol for which to retrieve a component. This protocol must extend the [`MDLComponent`](/documentation/ModelIO/MDLComponent) protocol.

## Return Value

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

## Discussion

Components are the basis for customizable file format and object graph support in Model I/O. By default, the [`MDLObject`](/documentation/ModelIO/MDLObject) uses the [`MDLObjectContainerComponent`](/documentation/ModelIO/MDLObjectContainerComponent) and [`MDLTransformComponent`](/documentation/ModelIO/MDLTransformComponent) protocols to model object hierarchies and spatial transforms: When you load an object graph from a [`MDLAsset`](/documentation/ModelIO/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`](/documentation/ModelIO/MDLObjectContainerComponent) could implement other ways to store or traverse object hierarchies.

---

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)