Instance Method


Establishes a local connection to a peripheral.


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



The peripheral to which the central is attempting to connect.


A dictionary to customize the behavior of the connection. For available options, see Peripheral Connection Options.


If a local connection to a peripheral is successfully established, 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 do not time out. To explicitly cancel a pending connection to a peripheral, call the cancelPeripheralConnection(_:) method. The cancelPeripheralConnection(_:) method is implicitly called when peripheral is deallocated.

See Also

Establishing or Canceling Connections with Peripherals

func cancelPeripheralConnection(CBPeripheral)

Cancels an active or pending local connection to a peripheral.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software