Skip to content

Instantly share code, notes, and snippets.

@regularberry
Last active September 23, 2020 20:11
Show Gist options
  • Save regularberry/2349344d6c715119ab1e5f72f89c5ae5 to your computer and use it in GitHub Desktop.
Save regularberry/2349344d6c715119ab1e5f72f89c5ae5 to your computer and use it in GitHub Desktop.
import ClassKit
class ActivityCreator: NSObject, CLSDataStoreDelegate {
static let shared = ActivityCreator()
override init() {
super.init()
CLSDataStore.shared.delegate = self
}
func createContext(forIdentifier identifier: String, parentContext: CLSContext, parentIdentifierPath: [String]) -> CLSContext? {
if identifier == "MATH-JAM" {
let context = CLSContext(type: .game, identifier: "MATH-JAM", title: "Math Jam")
context.topic = .math
return context
} else if identifier == "WORD-JAM" {
let context = CLSContext(type: .game, identifier: "WORD-JAM", title: "Word Jam")
context.topic = .literacyAndWriting
return context
} else {
return nil
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment