---
title: "addOutputPort(withType:forKey:withAttributes:)"
framework: quartz
role: symbol
role_heading: Instance Method
path: "quartz/qcplugin/addoutputport(withtype:forkey:withattributes:)"
---

# addOutputPort(withType:forKey:withAttributes:)

Adds an output port of the specified type and associates a key and attributes with the port.

## Declaration

```swift
func addOutputPort(withType type: String!, forKey key: String!, withAttributes attributes: [AnyHashable : Any]! = [:])
```

## Parameters

- `type`: The port type. See doc://com.apple.quartz/documentation/Quartz/port-input-and-output-types.
- `key`: The key to associate with the port.
- `attributes`: A dictionary of attributes for the port. See doc://com.apple.quartz/documentation/Quartz/input-and-output-port-attributes. Although the dictionary is optional, it’s recommended that provide attributes to enhance the experience of those who use your custom patch. The attributes appear in a help tag when the user hovers a pointer over the property port on your custom patch. (See doc://com.apple.quartz/documentation/Quartz/QCPlugIn/attributesForPropertyPort(withKey:).) Pass nil if you do not want to provide attributes.

## Discussion

Discussion This method throws an exception if called from within the execute(_:atTime:withArguments:) method or if there is already an output port with that key.

## See Also

### Adding Ports Dynamically

- [addInputPort(withType:forKey:withAttributes:)](quartz/qcplugin/addinputport(withtype:forkey:withattributes:).md)
- [removeInputPort(forKey:)](quartz/qcplugin/removeinputport(forkey:).md)
- [removeOutputPort(forKey:)](quartz/qcplugin/removeoutputport(forkey:).md)
