---
title: "add(_:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsobjectcontroller/add(_:)"
---

# add(_:)

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

## Declaration

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

## Parameters

- `sender`: Typically the object that invoked this method.

## Discussion

Discussion Creates a new object of the appropriate entity (specified by entityName) or class (specified by objectClass)—see newObject()—and sets it as the receiver’s content object using 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.

## See Also

### Managing objects

- [newObject()](appkit/nsobjectcontroller/newobject().md)
- [addObject(_:)](appkit/nsobjectcontroller/addobject(_:).md)
- [removeObject(_:)](appkit/nsobjectcontroller/removeobject(_:).md)
- [canAdd](appkit/nsobjectcontroller/canadd.md)
- [remove(_:)](appkit/nsobjectcontroller/remove(_:).md)
- [canRemove](appkit/nsobjectcontroller/canremove.md)
