0

Can I update data in Today Extension, while it's in background? In a sense not visibile on screen. Or Only it's showing on the screen in method widgetPerformUpdateWithCompletionHandler??? thx for answers!

1 Answers1

1

Today extension is automatically updated in the background. The NCWidgetProviding protocol method widgetPerformUpdate handles this.

   func widgetPerformUpdate(completionHandler: @escaping (NCUpdateResult) -> Swift.Void)
    {
        completionHandler(NCUpdateResult.newData)
    }

This method is called:

  1. When widget is updated in background.
  2. Before widget snapshot is taken.

For more you can refer to: https://github.com/pgpt10/Today-Widget

PGDev
  • 23,751
  • 6
  • 34
  • 88