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

# NSController

An abstract class that implements the [`NSEditor`](/documentation/AppKit/NSEditor) and [`NSEditorRegistration`](/documentation/AppKit/NSEditorRegistration) informal protocols required for controller classes.

```
class NSController
```

## Topics

### Managing editing

[`-  objectDidBeginEditing:`](/documentation/AppKit/NSController/objectDidBeginEditing(_:))

Invoked to inform the receiver that `editor` has uncommitted changes that can affect the receiver.

[`-  objectDidEndEditing:`](/documentation/AppKit/NSController/objectDidEndEditing(_:))

Invoked to inform the receiver that `editor` has committed or discarded its changes.

[`-  commitEditing`](/documentation/AppKit/NSController/commitEditing())

Attempts to commit any pending edits.

[`-  commitEditingWithDelegate:didCommitSelector:contextInfo:`](/documentation/AppKit/NSController/commitEditing(withDelegate:didCommit:contextInfo:))

Attempts to commit any pending changes in known editors of the receiver.

[`-  discardEditing`](/documentation/AppKit/NSController/discardEditing())

Discards any pending changes by registered editors.

[`editing`](/documentation/AppKit/NSController/isEditing)

A Boolean value indicating if any editors are registered with the controller.

### Initializers

[`-  init`](/documentation/AppKit/NSController/init())

[`-  initWithCoder:`](/documentation/AppKit/NSController/init(coder:))

## Relationships

### Conforms To

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`NSEditorRegistration`](/documentation/AppKit/NSEditorRegistration)

[`Hashable`](/documentation/Swift/Hashable)

[`NSCoding`](/documentation/Foundation/NSCoding)

[`Equatable`](/documentation/Swift/Equatable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`NSEditor`](/documentation/AppKit/NSEditor)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CVarArg`](/documentation/Swift/CVarArg)

### Inherited By

[`NSObjectController`](/documentation/AppKit/NSObjectController)

[`NSUserDefaultsController`](/documentation/AppKit/NSUserDefaultsController)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

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)