---
title: "init(context:)"
framework: coredata
role: symbol
role_heading: Initializer
path: "coredata/nsmanagedobject/init(context:)"
---

# init(context:)

Initializes a managed object subclass and inserts it into the specified managed object context.

## Declaration

```swift
convenience init(context moc: NSManagedObjectContext)
```

## Return Value

Return Value An initialized instance of the appropriate subclass.

## Discussion

Discussion This method is only legal to call on subclasses of NSManagedObject that represent a single entity in the model.

## See Also

### Creating a Managed Object

- [init(entity:insertInto:)](coredata/nsmanagedobject/init(entity:insertinto:).md)
