<!--
{
  "availability" : [
    "iOS: 11.3.0 -",
    "iPadOS: 11.3.0 -",
    "macCatalyst: 11.3.0 -",
    "macOS: 11.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "ClassKit",
  "identifier" : "/documentation/ClassKit/CLSDataStoreDelegate",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "ClassKit"
    ],
    "preciseIdentifier" : "c:objc(pl)CLSDataStoreDelegate"
  },
  "title" : "CLSDataStoreDelegate"
}
-->

# CLSDataStoreDelegate

An interface the data store uses to request new contexts.

```
protocol CLSDataStoreDelegate : NSObjectProtocol
```

## Overview

When you request a context from the data store, for example using a call to the [`descendant(matchingIdentifierPath:completion:)`](/documentation/ClassKit/CLSContext/descendant(matchingIdentifierPath:completion:)) method, the data store first tries to locate an existing context matching the search criterion (an identifier path in this case) in its database. Depending on certain conditions, the context might already exist in the database from the last time you requested it. If it does, the data store returns the stored context. But if it doesn’t exist, the data store asks its delegate to build a new context.

Adopt the data store delegate protocol to provide contexts on demand.

You can alternatively build contexts directly without relying on the delegate callback. However, it’s generally most efficient to use the delegate protocol, building contexts only when they’re missing from the data store.

## Topics

### Creating Contexts

[`func createContext(forIdentifier: String, parentContext: CLSContext, parentIdentifierPath: [String]) -> CLSContext?`](/documentation/ClassKit/CLSDataStoreDelegate/createContext(forIdentifier:parentContext:parentIdentifierPath:))

Asks the delegate for a new context with the given identifier for the given parent context.

## Relationships

### Inherits From

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

---

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)