---
title: "init(name:managedObjectModel:)"
framework: coredata
role: symbol
role_heading: Initializer
path: "coredata/nspersistentcontainer/init(name:managedobjectmodel:)"
---

# init(name:managedObjectModel:)

Create a container with the specified name and managed object model.

## Declaration

```swift
init(name: String, managedObjectModel model: NSManagedObjectModel)
```

## Parameters

- `name`: The name used by the persistent container.
- `model`: The managed object model to be used by the persistent container.

## Return Value

Return Value A persistent container initialized with the given name and model.

## Discussion

Discussion By default, the provided name value of the container is used as the name of the persisent store associated with the container. Passing in the NSManagedObjectModel object overrides the lookup of the model by the provided name value.

## See Also

### Creating a Container

- [init(name:)](coredata/nspersistentcontainer/init(name:).md)
