how to update widget UI?

Asked on 06/16/2025

1 search

To update a widget's UI, you can use several methods depending on the nature of the update and the platform. Here are some options based on the content from the WWDC sessions:

  1. Scheduled Timeline Reloads: Use the Timeline reload policy to update widgets at regular intervals. This is suitable for widgets that need to display information like weather or stock updates. The system budgets these reloads to maintain performance and battery life.

  2. Widget Center API: If a data change occurs within the app, you can use the Widget Center's reloadAllTimelines or reloadTimelines(ofKind:) methods to request a widget update. This is not budgeted by the system since the app is running when this API is called.

  3. Push Widget Updates: For data changes that occur on a server or another device, you can use push notifications to update widgets. This involves creating a widget push handler and adding it to your widget configuration. Push updates are budgeted to maintain performance and battery life.

For more detailed information on implementing push updates, you can refer to the session What’s new in widgets (18:12).

These methods provide a comprehensive suite of options to keep your widget's UI up to date across different scenarios and platforms.