<!--
{
  "availability" : [
    "macOS: 10.4.0 - 10.15.0"
  ],
  "documentType" : "symbol",
  "framework" : "Quartz",
  "identifier" : "/documentation/Quartz/QCCompositionRenderer/setValue(_:forInputKey:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Quartz"
    ],
    "preciseIdentifier" : "c:objc(pl)QCCompositionRenderer(im)setValue:forInputKey:"
  },
  "title" : "setValue(_:forInputKey:)"
}
-->

# setValue(_:forInputKey:)

Sets the value for an input port of a composition.

```
func setValue(_ value: Any!, forInputKey key: String!) -> Bool
```

## Parameters

`value`

The value to set for the input port. The input port must be at the root patch of the composition. The data type of the `value` argument must match the input port. See [`QCPortAttributeTypeKey`](/documentation/Quartz/QCPortAttributeTypeKey) for the data types accepted by a particular port type.

`key`

The key associated with the input port of the composition. This method throws an exception if `key` is invalid.

## Return Value

Returns <doc://com.apple.documentation/documentation/Swift/false> if it cannot set the value.

---

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)