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

# CLSContextProvider

An interface used to tell your ClassKit context provider app extension to update contexts.

```
protocol CLSContextProvider
```

## Overview

The primary class of a ClassKit context provider extension adopts the [`CLSContextProvider`](/documentation/ClassKit/CLSContextProvider) protocol. The protocol’s one required method tells the app extension to create or update the descendants of a given context. Schoolwork causes this method to fill in your context hierarchy incrementally as the teacher browses your app’s content.

You still build contexts in your main app to support your app’s normal operation, as described in <doc://com.apple.classkit/documentation/ClassKit/advertising-your-app-s-assignable-content>. By also creating a context provider app extension, you enable Schoolwork to advertise your content without having to rely on the teacher first running your app.

### Create a ClassKit Context Provider App Extension

Create a ClassKit context provider by adding a new target to your project in Xcode using File > New > Target. Choose the ClassKit context provider template and give it a name.

![Screenshot of ClassKit context provider template selection in Xcode.](images/com.apple.classkit/media-3125786@2x.png)

Xcode adds several supporting files to your project, including a new source file that defines the extension’s primary class that adopts the [`CLSContextProvider`](/documentation/ClassKit/CLSContextProvider) protocol. Fill in the empty [`updateDescendants(of:completion:)`](/documentation/ClassKit/CLSContextProvider/updateDescendants(of:completion:)) method with your implementation.

You typically call on the context-building code of your main app in the app extension to avoid duplicating code. Do this by either linking the app extension against the relevant source files in your main app, or by putting the common code into a framework. For an example of the former, see the sample code in <doc://com.apple.classkit/documentation/ClassKit/incorporating-classkit-into-an-educational-app>.

For a general discussion about app extensions, see [App Extension Programming Guide](https://developer.apple.com/library/archive/documentation/General/Conceptual/ExtensibilityPG/index.html#//apple_ref/doc/uid/TP40014214).

## Topics

### Updating contexts

[`updateDescendants(of:completion:)`](/documentation/ClassKit/CLSContextProvider/updateDescendants(of:completion:))

Updates the descendants of the given context.



---

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)