<!--
{
  "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/defaultDirectoryURL()",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Core Data"
    ],
    "preciseIdentifier" : "c:objc(cs)NSPersistentContainer(cm)defaultDirectoryURL"
  },
  "title" : "defaultDirectoryURL()"
}
-->

# defaultDirectoryURL()

Returns the location of the directory that contains the persistent stores.

```
class func defaultDirectoryURL() -> URL
```

## Return Value

An <doc://com.apple.documentation/documentation/Foundation/NSURL> that references the directory in which the persistent store(s) will be located or are currently located.

## Discussion

This method returns a platform-dependent <doc://com.apple.documentation/documentation/Foundation/NSURL> at which the persistent store(s) will be located or are currently located. This method can be overridden in a subclass of [`NSPersistentContainer`](/documentation/CoreData/NSPersistentContainer).

---

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)