---
title: "connect(_:options:)"
framework: corebluetooth
role: symbol
role_heading: Instance Method
path: "corebluetooth/cbcentralmanager/connect(_:options:)"
---

# connect(_:options:)

Establishes a local connection to a peripheral.

## Declaration

```swift
func connect(_ peripheral: CBPeripheral, options: [String : Any]? = nil)
```

## Parameters

- `peripheral`: The peripheral to which the central is attempting to connect.
- `options`: A dictionary to customize the behavior of the connection. For available options, see doc://com.apple.corebluetooth/documentation/CoreBluetooth/peripheral-connection-options.

## Discussion

Discussion After successfully establishing a local connection to a peripheral, the central manager object calls the centralManager(_:didConnect:) method of its delegate object. If the connection attempt fails, the central manager object calls the centralManager(_:didFailToConnect:error:) method of its delegate object instead. Attempts to connect to a peripheral don’t time out. To explicitly cancel a pending connection to a peripheral, call the cancelPeripheralConnection(_:) method. Deallocating peripheral also implicitly calls cancelPeripheralConnection(_:).

## See Also

### Establishing or Canceling Connections with Peripherals

- [Peripheral Connection Options](corebluetooth/peripheral-connection-options.md)
- [cancelPeripheralConnection(_:)](corebluetooth/cbcentralmanager/cancelperipheralconnection(_:).md)
