Skip to content

Instantly share code, notes, and snippets.

@andrew-codechimp
Created March 3, 2021 14:38
Show Gist options
  • Select an option

  • Save andrew-codechimp/e5be043529e8feb89705946693a01122 to your computer and use it in GitHub Desktop.

Select an option

Save andrew-codechimp/e5be043529e8feb89705946693a01122 to your computer and use it in GitHub Desktop.
@Environment(\.scenePhase) var scenePhase
...
WindowGroup {
...
}.onChange(of: scenePhase) { phase in
switch phase {
case .background:
let server = CLKComplicationServer.sharedInstance()
for complication in server.activeComplications ?? [] {
server.reloadTimeline(for: complication)
}
server.reloadComplicationDescriptors()
default: break
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment