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

# add(_:)

Creates a new object and sets it as the receiver’s content object.

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

## Parameters

`sender`

Typically the object that invoked this method.

## Discussion

Creates a new object of the appropriate entity (specified by [`entityName`](/documentation/AppKit/NSObjectController/entityName)) or class (specified by [`objectClass`](/documentation/AppKit/NSObjectController/objectClass))—see [`newObject()`](/documentation/AppKit/NSObjectController/newObject())—and sets it as the receiver’s content object using [`addObject(_:)`](/documentation/AppKit/NSObjectController/addObject(_:)).

### Special Considerations

Beginning with OS X v10.4 the result of this method is deferred until the next iteration of the runloop so that the error presentation mechanism can provide feedback as a sheet.

---

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)