Dunfey · Hotel WWDC as data, est. 1983
Front desk everything
Years
Topics

2021 Business & Education

WWDC21 · 14 min · Business & Education

Meet ClassKit for file-based apps

The ClassKit framework can help surface educational activities within your app to teachers using the Schoolwork app. Discover how you can provide teachers with greater insights into student learning by adopting the latest file-based API to report student progress data within your app. We’ll also show you how to use ClassKit to report out different data types, and how to test your implementation in developer mode.

Watch at developer.apple.com ↗

Transcript all transcripts

Code shown on screen · 5 snippets

openFile() swift · at 7:25 ↗
func openFile() async throws {
     // Your existing code for opening a file goes here.
     let activity = await try CLSDataStore.shared.fetchActivity(for: fileURL)
     activity.start()
     await try CLSDataStore.shared.save()
}
closeFile() swift · at 8:07 ↗
func closeFile() async throws {
     let activity = await try CLSDataStore.shared.fetchActivity(for: fileURL)
     let wordCount = activity.primaryActivityItem as? CLSQuantityItem ??
         CLSQuantityItem(identifier: "total_word_count", title: "Word Count")
     wordCount.quantity = currentDocumentWordCount()
     activity.primaryActivityItem = wordCount
     activity.progress = progress()
     activity.stop()
     await try CLSDataStore.shared.save()
}
closeFile()2 swift · at 8:48 ↗
func closeFile() async throws {
     let activity = await try CLSDataStore.shared.fetchActivity(for: fileURL)
     let wordCount = activity.primaryActivityItem as? CLSQuantityItem ??
         CLSQuantityItem(identifier: "total_word_count", title: "Word Count")
     wordCount.quantity = currentDocumentWordCount()
     activity.primaryActivityItem = wordCount
     activity.progress = progress()
     activity.stop()
     await try CLSDataStore.shared.save()
}
openFile() BreakPointHit swift · at 11:20 ↗
func openFile() async throws {
     // Your existing code for opening a file goes here.
     let activity = await try CLSDataStore.shared.fetchActivity(for: fileURL)
     activity.start()
     await try CLSDataStore.shared.save()
}
closeFile() BreakPointhit swift · at 11:55 ↗
func closeFile() async throws {
     let activity = await try CLSDataStore.shared.fetchActivity(for: fileURL)
     let wordCount = activity.primaryActivityItem as? CLSQuantityItem ??
         CLSQuantityItem(identifier: "total_word_count", title: "Word Count")
     wordCount.quantity = currentDocumentWordCount()
     activity.primaryActivityItem = wordCount
     activity.progress = progress()
     activity.stop()
     await try CLSDataStore.shared.save()
}

Resources