<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSUserDefaultsController/revert(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSUserDefaultsController(im)revert:"
  },
  "title" : "revert(_:)"
}
-->

# revert(_:)

Causes the receiver to discard any unsaved changes to bound user default properties, restoring their previous values.

```
@IBAction func revert(_ sender: Any?)
```

## Discussion

The receiver invokes <doc://com.apple.documentation/documentation/ObjectiveC/NSObject-swift.class/discardEditing> on any currently registered editors. The `sender` is typically the object that invoked this method.

If [`appliesImmediately`](/documentation/AppKit/NSUserDefaultsController/appliesImmediately) is <doc://com.apple.documentation/documentation/Swift/true>, this method only causes any bound editors with uncommitted changes to discard their edits.

---

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)