how to setup a widget from scratch

Asked on 06/16/2025

1 search

To set up a widget from scratch, you can follow these general steps based on the information from the WWDC sessions:

  1. Define the Widget: Start by creating a widget definition. This involves setting up the basic structure of your widget, including its view and timeline provider. The timeline provider is responsible for supplying the data that your widget will display.

  2. Configure the Widget: Use a widget configuration to define how your widget will behave. This includes setting up the entry provider, which creates the entries that populate your widget's view. For timeline-based widgets, these entries are called Timeline Entries.

  3. Design the Widget's Appearance: Consider the design aspects of your widget. For example, in visionOS, widgets can be personalized with different color palettes and styles, such as paper or glass. Ensure your widget looks good across different system color palettes and styles.

  4. Add Interactivity: If your widget needs to be interactive, define the actions it should perform. This can be done using app intents, which allow your widget to execute actions when interacted with.

  5. Test and Customize: Test your widget across different environments and customize it to fit various spaces. For visionOS, consider how your widget will look when placed in different rooms and how it can be personalized by users.

  6. Implement Push Updates: If your widget needs to stay up-to-date with real-time information, implement push updates. This involves creating a widget push handler and adding it to your widget configuration.

For more detailed guidance, you can refer to the session Extend your app’s controls across the system (03:04) which covers building controls, or What’s new in widgets (15:31) for information on relevance widgets and push updates.