Contents

UICellAccessory

An accessory in a collection view list cell.

Declaration

struct UICellAccessory

Overview

A cell accessory is a visual element that you can add to a list cell (UICollectionViewListCell). You use a cell accessory as a visual indicator or to let a user perform a cell-specific action like selecting, reordering, or deleting the cell. A cell accessory appears either on the leading or the trailing edge of a cell, outside of the cell’s content view.

UIKit defines a set of standard system cell accessories. System accessories have default system-defined appearances, but you can make some customizations to them, like setting a custom tint color. You can’t customize the placement of system accessories. If you want additional customization, you can create a custom accessory with customView(configuration:).

You add accessories to a list cell by setting its accessories array.

cell.accessories = [ 
    .checkmark(), 
    .disclosureIndicator(options: .init(tintColor: .systemGray)), 
    .delete(),
    .reorder() 
]

Topics

Creating a disclosure indicator

Creating an outline disclosure

Creating a popup menu accessory

Creating a checkmark accessory

Creating a delete accessory

Creating an insert accessory

Creating a reorder accessory

Creating a multiselect accessory

Creating a label accessory

Creating a detail accessory

Creating a custom accessory

Checking the accessory’s type

Customizing appearance and placement

Performing accessory actions

See Also

Managing cell accessories