<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIButton/configurationUpdateHandler-swift.property",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIButton(py)configurationUpdateHandler"
  },
  "title" : "configurationUpdateHandler"
}
-->

# configurationUpdateHandler

A closure that executes when the button state changes.

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

## Discussion

Use this property as an alternative to overriding [`updateConfiguration()`](/documentation/UIKit/UIButton/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](/documentation/UIKit/automatic-trait-tracking).

This closure supports automatic observation tracking. For more information, see [Updating views automatically with observation tracking in UIKit](/documentation/UIKit/updating-views-automatically-with-observation-tracking-in-uikit).

---

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)