---
title: configurationUpdateHandler
framework: uikit
role: symbol
role_heading: Instance Property
path: uikit/uibutton/configurationupdatehandler-swift.property
---

# configurationUpdateHandler

A closure that executes when the button state changes.

## Declaration

```swift
var configurationUpdateHandler: UIButton.ConfigurationUpdateHandler? { get set }
```

## Discussion

Discussion Use this property as an alternative to overriding updateConfiguration(). Set a closure to respond to button state changes by updating the button configuration. In iOS 18 and later, UIKit supports automatic trait tracking inside this closure for traits from this button’s traitCollection. For more information, see Automatic trait tracking. This closure supports automatic observation tracking. For more information, see Updating views automatically with observation tracking.

## See Also

### Observing data in buttons

- [updateConfiguration()](uikit/uibutton/updateconfiguration().md)
