Skip to content

Instantly share code, notes, and snippets.

@regularberry
Last active September 25, 2020 22:23
Show Gist options
  • Save regularberry/3434df7c946b4696d0a55091441d28b2 to your computer and use it in GitHub Desktop.
Save regularberry/3434df7c946b4696d0a55091441d28b2 to your computer and use it in GitHub Desktop.
let quantity = CLSQuantityItem(identifier: "Score", title: "Score")
quantity.quantity = Double(score)
CLSDataStore.shared.mainAppContext.descendant(matchingIdentifierPath: identifierPath) { context, _ in
guard let activity = context?.currentActivity else { return }
activity.primaryActivityItem = quantity
CLSDataStore.shared.save()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment