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

# value(forOutputKey:ofType:)

Returns the current value on an output port (identified by its key) of the root patch of the composition.

```
func value(forOutputKey key: String!, ofType type: String!) -> Any!
```

## Parameters

`key`

The key associated with an output port for the root patch of a composition. This method throws an exception if `key` is invalid.

`type`

A string that specifies the class.

## Return Value

The value.

## Discussion

The value type depends on the type of the port type, as shown in the following table

|Port type                |Value type                                                                                                                                                                                                                                                                                                                                                                                                                     |
|-------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|Boolean, Index, or Number|<doc://com.apple.documentation/documentation/Foundation/NSNumber> or any object that responds to the methods `integerValue`, `floatValue`, or `doubleValue`                                                                                                                                                                                                                                                                    |
|String                   |<doc://com.apple.documentation/documentation/Foundation/NSString> or any object that responds to the methods`stringValue` or `description`                                                                                                                                                                                                                                                                                     |
|Color                    |<doc://com.apple.documentation/documentation/AppKit/NSColor>, <doc://com.apple.documentation/documentation/CoreImage/CIColor>, or `CGColor` object                                                                                                                                                                                                                                                                             |
|Image                    |<doc://com.apple.documentation/documentation/AppKit/NSImage>, <doc://com.apple.documentation/documentation/AppKit/NSBitmapImageRep>, `CGImage` object, <doc://com.apple.documentation/documentation/CoreImage/CIImage>, `CVPixelBuffer` object, `CVOpenGLBuffer` object, or an opaque `QCImage` (that is, an optimized abstract image object only to be used with `setValue:forInputKey:` of another `<QCCompositionRenderer>`)|
|Structure                |<doc://com.apple.documentation/documentation/Foundation/NSArray> or <doc://com.apple.documentation/documentation/Foundation/NSDictionary>                                                                                                                                                                                                                                                                                      |

---

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)