<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CarPlay",
  "identifier" : "/documentation/CarPlay/CPListItem/handler",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "CarPlay"
    ],
    "preciseIdentifier" : "c:objc(cs)CPListItem(py)handler"
  },
  "title" : "handler"
}
-->

# handler

An optional closure that CarPlay invokes when the user selects the list item.

```
var handler: ((any CPSelectableListItem, @escaping () -> Void) -> Void)? { get set }
```

## Discussion

In Swift, the handler is a closure that has two parameters:

- An object that conforms to [`CPSelectableListItem`](/documentation/CarPlay/CPSelectableListItem), which is the list item that the user selects.
- The completion closure you call to notify CarPlay when you finish processing the selection.

In Objective-C, the block’s parameters are:

- `item`: The list item that the user selects.
- `completionBlock`: The block you call to notify CarPlay when you finish processing the selection.

CarPlay executes your handler on the main queue. You must call the completion closure, or `completionBlock` in Objective-C, after you finish processing the selection. If you need to perform asynchronous tasks, dispatch them to a background queue and call the completion closure or `completionBlock` when they complete. CarPlay displays an asynchronous progress indicator until you call the completion closure.

---

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)