<!--
{
  "availability" : [
    "iOS: 3.0.0 -",
    "iPadOS: 3.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.5.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreData",
  "identifier" : "/documentation/CoreData/NSAtomicStore/init(persistentStoreCoordinator:configurationName:at:options:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Core Data"
    ],
    "preciseIdentifier" : "c:objc(cs)NSAtomicStore(im)initWithPersistentStoreCoordinator:configurationName:URL:options:"
  },
  "title" : "init(persistentStoreCoordinator:configurationName:at:options:)"
}
-->

# init(persistentStoreCoordinator:configurationName:at:options:)

Creates an atomic store at the specified location.

```
init(persistentStoreCoordinator coordinator: NSPersistentStoreCoordinator?, configurationName: String?, at url: URL, options: [AnyHashable : Any]? = nil)
```

## Parameters

`coordinator`

The persistent store coordinator.

`configurationName`

The name of the store’s configuration in the managed object model.

`url`

The URL of the store to load. This value can’t be `nil`.

`options`

A dictionary that contains the store’s options. For possible values, see [Store options](/documentation/CoreData/store-options).

## Discussion

Typically, you don’t invoke this method yourself; instead, the persistent store coordinator invokes the method when it creates a new store or adds an existing one.

In your implementation, check whether a file exists at `url`. If it doesn’t exist, create a zero-length file at `url` so that the file exists before the coordinator calls the store’s [`load()`](/documentation/CoreData/NSAtomicStore/load()) method. A zero-length file indicates to the system that it should create a new store at that location. If the coordinator removes the store without first calling [`save()`](/documentation/CoreData/NSAtomicStore/save()), delete the zero-length file.

It’s your responsibility to load the store’s metadata during initialization and set it using the [`setMetadata(_:forPersistentStoreAt:)`](/documentation/CoreData/NSPersistentStore/setMetadata(_:forPersistentStoreAt:)) method.

> Important:
> If you override this method, you must invoke the superclass implementation to ensure that Core Data correctly initializes the store.

---

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)