<!--
{
  "documentType" : "article",
  "framework" : "ClassKit",
  "identifier" : "/documentation/ClassKit/creating-bookmarks-and-assignments-from-your-app",
  "metadataVersion" : "0.1.0",
  "role" : "article",
  "title" : "Creating bookmarks and assignments from your app"
}
-->

# Creating bookmarks and assignments from your app

Make it easier for teachers to find and assign your content.

## Discussion

When you adopt ClassKit and declare your app’s assignable content, teachers can use Apple’s Schoolwork app to assign your content to students. They do this by creating a new Assignment in Schoolwork.

![Screenshot showing the New Assignment view in the Schoolwork app, highlighting the button you tap to open the view, and the button within the view that you tap to add activities.](images/com.apple.classkit/media-3119327@2x.png)

From the New Assignment view, the teacher taps Add Activities to choose items to add to the Assignment. The popover that appears has an App Activities option that provides access to the content in apps like yours. The popover also has options for adding other supporting material to the assignment, like files, links, photos, or videos.

![Screenshot showing the popover that appears when you tap the Add Activities button in a Create new Assignment view.](images/com.apple.classkit/media-3016828@2x.png)

You can make it easier for teachers to find your app’s content in Schoolwork by letting them bookmark it as they encounter the content in your app. The bookmarks they create from within your app appear under the Bookmarks entry in the Add Activity popover shown above.

To enable bookmarks, you provide a ClassKit context ([`CLSContext`](/documentation/ClassKit/CLSContext)) to an activity view controller as described below. When you do this, Schoolwork offers a bookmark creation action extension in the activity view. Inside the same activity view, Schoolwork also offers a share extension that provides a shortcut to Assignment creation. This allows teachers to create assignments without leaving your app.

### Associate action buttons with content

To provide a point from which to launch an activity view in your app, add one or more <doc://com.apple.documentation/documentation/UIKit/UIBarButtonItem/SystemItem/action> buttons to your interface. Users know that tapping an action button typically reveals a modal activity view with share and action extensions that are relevant to the current task, as described in [Activity Views](https://developer.apple.com/design/human-interface-guidelines/ios/views/activity-views/). Add action buttons to your app’s UI in places that correspond to activities that a teacher might want to assign right away or to bookmark for later assignment.

![Screenshot showing an action button that appears in the navigation bar in the Great Plays sample app.](images/com.apple.classkit/media-3021754@2x.png)

When deciding where to place action buttons in your UI, choose locations that clearly correspond to an assignable task. For example, in a play reader like the Great Plays sample app (see <doc://com.apple.classkit/documentation/ClassKit/incorporating-classkit-into-an-educational-app>), users would expect an action button that appears with a play’s table of contents, as shown in the figure above, to apply to the play as a whole. On the other hand, an action button that appears as part of a quiz should apply specifically to that quiz.

### Initialize and present an activity view

For each action button you add to your UI, add a corresponding method that’s called when the person taps the button. Use this method to initialize and present an instance of a <doc://com.apple.documentation/documentation/UIKit/UIActivityViewController>. Initialize the activity view with the [`CLSContext`](/documentation/ClassKit/CLSContext) corresponding to the assignable task the person would expect, given the state of your app at the time. For example, if they tap the action button on the table of contents shown in the previous section, provide the play context as the activity item:

```swift
 let activityView = UIActivityViewController(activityItems: [playContext, self],
                                                        applicationActivities: nil)
```

Then present the activity view. On iPad, you present an activity view as a popover, typically originating from the tapped action button.

```swift
 activityView.modalPresentationStyle = .popover
 activityView.popoverPresentationController?.permittedArrowDirections = .any
 activityView.popoverPresentationController?.barButtonItem = actionButtonItem
 activityView.excludedActivityTypes = [ UIActivity.ActivityType.message, UIActivity.ActivityType.mail]
 self.present(activityView, animated: true)
```

### Update activity view metadata

To provide context to the user about the information in the activity view, add the meta data describing the information they’re sharing by conforming your view controller to the <doc://com.apple.documentation/documentation/UIKit/UIActivityItemSource> protocol.

```swift
import LinkPresentation

class ActsTableViewController: UITableViewController, UIActivityItemSource 
```

The <doc://com.apple.documentation/documentation/UIKit/UIActivityItemSource/activityViewControllerLinkMetadata(_:)> delegate method provides the <doc://com.apple.documentation/documentation/LinkPresentation/LPLinkMetadata> to the activity view for the icon and title. This provides context to the user for the shared information. In the below example, the Hamlet Play title and icon indicate the context of the information shared with Schoolwork.

```swift
func activityViewControllerLinkMetadata(_ activityViewController: UIActivityViewController) -> LPLinkMetadata? {
        guard let image = UIImage(named: "IconImage") else {return nil}
        let imageProvider = NSItemProvider(object: image)
        let metadata = LPLinkMetadata()
        metadata.iconProvider = imageProvider
        if let title = play?.title {
            metadata.title = "\(title) Play"
        }
        return metadata
}
```

The system recognizes ClassKit context activity items as relevant to the Schoolwork app and offers the two extensions Schoolwork provides in the activity view.

![Screenshot showing the activity view that appears when you tap the action button in the Great Plays sample code app, highlighting the two extensions provided by Schoolwork.](images/com.apple.classkit/media-4305224@2x.png)

If the user taps the first of these extensions, titled Schoolwork, Schoolwork initiates the New Assignment view with the given context right inside your app. The context is already populated in the Assignment:

![Screenshot showing the New Assignment view that appears inside your app when the user taps the Schoolwork icon in the activity view.](images/com.apple.classkit/media-4305226@2x.png)

If the user taps the second share extension icon, titled Save to Schoolwork, Schoolwork creates a bookmark of the corresponding context without any additional UI.

![Screenshot showing Add to Bookmarks view that appears in your app when the users taps on Save To Schoolwork icon in an activity view.](images/com.apple.classkit/media-4305228@2x.png)

The teacher can later find the bookmarked content in Schoolwork.

---

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)