---
title: "init(inputPorts:output:)"
framework: avfoundation
role: symbol
role_heading: Initializer
path: "avfoundation/avcaptureconnection/init(inputports:output:)"
---

# init(inputPorts:output:)

Creates a capture connection that represents a connection between multiple input ports and an output.

## Declaration

```swift
init(inputPorts ports: [AVCaptureInput.Port], output: AVCaptureOutput)
```

## Parameters

- `ports`: An array of doc://com.apple.avfoundation/documentation/AVFoundation/AVCaptureInput/Port instances that relate to doc://com.apple.avfoundation/documentation/AVFoundation/AVCaptureInput instances.
- `output`: An doc://com.apple.avfoundation/documentation/AVFoundation/AVCaptureOutput instance.

## Return Value

Return Value A capture connection that represents a connection between ports and output.

## Discussion

Discussion You can add the connection this method returns to an AVCaptureSession instance with the addConnection(_:) method. The addInput(_:): or addOutput(_:) methods automatically form connections between all compatible inputs and outputs. You don’t need to manually create and add connections to the session unless you use the primitive addInputWithNoConnections(_:) and addOutputWithNoConnections(_:) methods.

## See Also

### Creating a connection

- [init(inputPort:videoPreviewLayer:)](avfoundation/avcaptureconnection/init(inputport:videopreviewlayer:).md)
