---
title: NSPersistentStore
framework: coredata
role: symbol
role_heading: Class
path: coredata/nspersistentstore
---

# NSPersistentStore

The abstract base class for all Core Data persistent stores.

## Declaration

```swift
class NSPersistentStore
```

## Overview

Overview Core Data provides four store types—SQLite, Binary, XML, and In-Memory (the XML store is not available on iOS); these are described in Persistent Store Features. Core Data also provides subclasses of NSPersistentStore that you can use to define your own store types: NSAtomicStore and NSIncrementalStore. The Binary and XML stores are examples of atomic stores that inherit functionality from NSAtomicStore. Subclassing Notes You should not subclass NSPersistentStore directly. Core Data only supports subclassing of NSAtomicStore and NSIncrementalStore. The designated initializer is init(persistentStoreCoordinator:configurationName:at:options:). When you implement the initializer, you must ensure you load metadata during initialization and set it using metadata. You must override these methods: type metadata metadataForPersistentStore(with:) setMetadata(_:forPersistentStoreAt:)

## Topics

### Creating a Persistent Store

- [init(persistentStoreCoordinator:configurationName:at:options:)](coredata/nspersistentstore/init(persistentstorecoordinator:configurationname:at:options:).md)

### Getting Store Configuration

- [configurationName](coredata/nspersistentstore/configurationname.md)
- [options](coredata/nspersistentstore/options.md)
- [persistentStoreCoordinator](coredata/nspersistentstore/persistentstorecoordinator.md)
- [type](coredata/nspersistentstore/type.md)
- [NSPersistentStore.StoreType](coredata/nspersistentstore/storetype.md)
- [Persistent Store Types](coredata/persistent-store-types.md)

### Managing Store Attributes

- [identifier](coredata/nspersistentstore/identifier.md)
- [isReadOnly](coredata/nspersistentstore/isreadonly.md)
- [url](coredata/nspersistentstore/url.md)

### Managing Store Metadata

- [metadataForPersistentStore(with:)](coredata/nspersistentstore/metadataforpersistentstore(with:).md)
- [setMetadata(_:forPersistentStoreAt:)](coredata/nspersistentstore/setmetadata(_:forpersistentstoreat:).md)
- [loadMetadata()](coredata/nspersistentstore/loadmetadata().md)
- [metadata](coredata/nspersistentstore/metadata.md)

### Responding to the Store Life Cycle

- [didAdd(to:)](coredata/nspersistentstore/didadd(to:).md)
- [willRemove(from:)](coredata/nspersistentstore/willremove(from:).md)

### Integrating with Spotlight

- [coreSpotlightExporter](coredata/nspersistentstore/corespotlightexporter.md)

### Providing a Migration Manager

- [migrationManagerClass()](coredata/nspersistentstore/migrationmanagerclass().md)

### Initializers

- [init(persistentStoreCoordinator:configurationName:URL:options:)](coredata/nspersistentstore/init(persistentstorecoordinator:configurationname:url:options:).md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Inherited By

- [NSAtomicStore](coredata/nsatomicstore.md)
- [NSIncrementalStore](coredata/nsincrementalstore.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Store Coordination

- [NSPersistentStoreCoordinator](coredata/nspersistentstorecoordinator.md)
- [NSPersistentStoreDescription](coredata/nspersistentstoredescription.md)
- [NSPersistentStoreRequest](coredata/nspersistentstorerequest.md)
- [NSPersistentStoreResult](coredata/nspersistentstoreresult.md)
- [NSPersistentStoreAsynchronousResult](coredata/nspersistentstoreasynchronousresult.md)
- [NSSaveChangesRequest](coredata/nssavechangesrequest.md)
- [NSAtomicStore](coredata/nsatomicstore.md)
- [NSAtomicStoreCacheNode](coredata/nsatomicstorecachenode.md)
- [NSIncrementalStore](coredata/nsincrementalstore.md)
- [NSIncrementalStoreNode](coredata/nsincrementalstorenode.md)
