Contents

connect(to:timeout:callback:)

Attempts to connect the central manager to the specified peripheral.

Declaration

func connect(to peripheral: CBPeripheral, timeout: TimeInterval? = nil, callback: ((CBPeripheral, Error?) -> Void)? = nil)

Parameters

  • peripheral:

    The peripheral to attempt to connect to.

  • timeout:

    The amount of time, in seconds, before the connection attempt is aborted. If the timeout value is nil, the attempt won’t time out. To cancel a connection attempt, call the 3029469 Disconnect method.

  • callback:

    A function that’s called when the connection attempt succeeds or fails.

See Also

Connecting Peripherals