Skip to content

Instantly share code, notes, and snippets.

@regularberry
Last active September 23, 2020 20:59
Show Gist options
  • Save regularberry/2ba472ebf99c141ae12557c4d745c7c0 to your computer and use it in GitHub Desktop.
Save regularberry/2ba472ebf99c141ae12557c4d745c7c0 to your computer and use it in GitHub Desktop.
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
CLSDataStore.shared.mainAppContext.descendant(matchingIdentifierPath: [game.identifier]) { context, _ in
context?.becomeActive()
if let activity = context?.currentActivity {
activity.start()
} else {
context?.createNewActivity().start()
}
CLSDataStore.shared.save()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment