Instance Method

completeAllAssignedActivities(matching:)

Marks all of the assigned and currently active activities for the given context path as complete.

Declaration

func completeAllAssignedActivities(matching contextPath: [String])

Parameters

contextPath

An array of strings that trace a path of identifiers from mainAppContext to a target context whose activities you want to mark as complete. This is the same identifier path you use for a call to the contexts(matchingIdentifierPath:completion:) method, but affects only the last context in the path.

Discussion

Schoolwork displays a per-student Done indicator to teachers, along with statistics about task completion for the entire class. Students set this indicator in their own view of the Schoolwork app. Use the completeAllAssignedActivities(matching:) method to set the Done status programmatically.

Because you’re taking an action on behalf of the student when you call this method, Schoolwork shows the student a momentary alert in your app’s interface at that time.

Call this method only when you know that the task is complete and the student can’t or won’t work on the task any further. This might be because the task’s allotted time elapses or because the student submits all the required information to the teacher. Alternatively, if you already have a submit button in your interface, you can call this method from that button’s handler.

See Also

Accessing Specific Contexts and Activities

var mainAppContext: CLSContext

The app’s top-level context.

var activeContext: CLSContext?

The currently active context.

var runningActivity: CLSActivity?

The currently running activity within the currently active context.