<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: 13.1.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIContextualAction",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIContextualAction"
  },
  "title" : "UIContextualAction"
}
-->

# UIContextualAction

An action to display when the user swipes a table row.

```
@MainActor class UIContextualAction
```

## Overview

Create [`UIContextualAction`](/documentation/UIKit/UIContextualAction) objects to define the types of actions that can be performed when the user swipes left or right on a table row. Use your actions to initialize a [`UISwipeActionsConfiguration`](/documentation/UIKit/UISwipeActionsConfiguration) object in your table view delegate object.

## Topics

### Creating the contextual action

[`init(style:title:handler:)`](/documentation/UIKit/UIContextualAction/init(style:title:handler:))

Creates a new contextual action with the specified title and handler.

### Configuring the appearance

[`title`](/documentation/UIKit/UIContextualAction/title)

The title displayed on the action button.

[`backgroundColor`](/documentation/UIKit/UIContextualAction/backgroundColor)

The background color of the action button.

[`image`](/documentation/UIKit/UIContextualAction/image)

The image to display in the action button.

### Getting the configuration details

[`handler`](/documentation/UIKit/UIContextualAction/handler-swift.property)

The handler block to execute when the user selects the action.

[`UIContextualAction.Handler`](/documentation/UIKit/UIContextualAction/Handler-swift.typealias)

The handler block to call in response to the selection of an action.

[`style`](/documentation/UIKit/UIContextualAction/style-swift.property)

The style that applies to the action button.

[`UIContextualAction.Style`](/documentation/UIKit/UIContextualAction/Style-swift.enum)

Constants indicating the style information that applies to the action button.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)