The CBPeripheral class represents remote peripheral devices that your app—by means of a central manager (an instance of CBCentralManager)—has discovered advertising or is currently connected to. Peripherals are identified by universally unique identifiers (UUIDs), represented by NSUUID objects. Peripherals may contain one or more services or provide useful information about their connected signal strength.


class CBPeripheral : CBPeer


You use this class to discover, explore, and interact with the services available on a remote peripheral that supports Bluetooth low energy. A service encapsulates the way part of the device behaves. For example, one service of a heart rate monitor may be to expose heart rate data from the monitor’s heart rate sensor. Services themselves are made up of characteristics or included services (references to other services). Characteristics provide further details about a peripheral’s service. For example, the heart rate service just described may contain one characteristic that describes the intended body location of the device’s heart rate sensor and another characteristic that transmits heart rate measurement data. Finally, characteristics contain any number of descriptors that provide more information about the characteristic’s value, such as a human-readable description and a way to format the value.


Identifying a Peripheral

var name: String?

The name of the peripheral.

var delegate: CBPeripheralDelegate?

The delegate object specified to receive peripheral events.

Discovering Services

func discoverServices([CBUUID]?)

Discovers the specified services of the peripheral.

func discoverIncludedServices([CBUUID]?, for: CBService)

Discovers the specified included services of a service.

var services: [CBService]?

A list of services on the peripheral that have been discovered.

Discovering Characteristics and Characteristic Descriptors

func discoverCharacteristics([CBUUID]?, for: CBService)

Discovers the specified characteristics of a service.

func discoverDescriptors(for: CBCharacteristic)

Discovers the descriptors of a characteristic.

Reading Characteristic and Characteristic Descriptor Values

func readValue(for: CBCharacteristic)

Retrieves the value of a specified characteristic.

func readValue(for: CBDescriptor)

Retrieves the value of a specified characteristic descriptor.

Writing Characteristic and Characteristic Descriptor Values

func writeValue(Data, for: CBDescriptor)

Writes the value of a characteristic descriptor.

Setting Notifications for a Characteristic’s Value

func setNotifyValue(Bool, for: CBCharacteristic)

Sets notifications or indications for the value of a specified characteristic.

Monitoring a Peripheral’s Connection State

var state: CBPeripheralState

The current connection state of the peripheral.

Accessing a Peripheral’s Received Signal Strength Indicator (RSSI) Data

func readRSSI()

Retrieves the current RSSI value for the peripheral while it is connected to the central manager.

var rssi: NSNumber?

The RSSI, in decibels, of the peripheral.



enum CBCharacteristicWriteType

Values representing the possible types of writes to a characteristic’s value.

enum CBPeripheralState

Values representing the current connection state of the peripheral.


Inherits From

Conforms To

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