<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.12.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 3.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreData",
  "identifier" : "/documentation/CoreData/NSPersistentContainer/init(name:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Core Data"
    ],
    "preciseIdentifier" : "c:objc(cs)NSPersistentContainer(im)initWithName:"
  },
  "title" : "init(name:)"
}
-->

# init(name:)

Creates a container with the specified name.

```
convenience init(name: String)
```

## Parameters

`name`

The name of the [`NSPersistentContainer`](/documentation/CoreData/NSPersistentContainer) object.

## Return Value

A persistent container initialized with the given name.

## Discussion

By default, the provided name value is used to name the persistent store and is used to look up the name of the [`NSManagedObjectModel`](/documentation/CoreData/NSManagedObjectModel) object to be used with the [`NSPersistentContainer`](/documentation/CoreData/NSPersistentContainer) object.

---

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)