One Logo Pool Ball
WidgetKit · IOS API REFERENCE

WidgetCenter

class · iOS 14.0+ · SDK 27.1

class WidgetCenter

An object that contains a list of user-configured widgets and is used for reloading widget timelines. WidgetCenter provides information about user-configured widgets, such as their family. For widgets that use <doc:IntentConfiguration>, you can retrieve the user-edited values. ### Getting Configured Widget Information To get a list of user-configured widgets, use <doc:WidgetCenter/getCurrentConfigurations(_:)>. This property provides an array of <doc:WidgetInfo> objects containing the following information: struct WidgetInfo { public let configuration: INIntent? public let family: WidgetFamily public let kind: String } The `kind` string matches the parameter you use when creating the widget's <doc:StaticConfiguration> or <doc:IntentConfiguration>. The `family` property matches one of the options specified in the <doc://com.apple.documentation/documentation/SwiftUI/WidgetConfiguration/supportedFamilies(_:)> property of the widget’s configuration. If your widget is based on <doc:IntentConfiguration>, the `configuration` property provides the custom intent containing the user-customized values for each individual widget. ### Requesting a Reload of Your Widget's Timeline Changes in your app’s state may affect a widget's timeline. When this happens, you can tell WidgetKit to reload the timeline for either a specific kind of widget or all widgets. For example, your app might register for push notifications based on the widgets the user has configured. When your app receives a push notification that changes the state for one or more of your widgets, requesting a reload of their timelines updates their display. If you only need to reload a certain kind of widget, you can request a reload for only that kind. For example, in response to a push notification about a change in a game’s status, you could request a reload for only the game status widgets: WidgetCenter.shared.reloadTimelines(ofKind: "com.mygame.gamestatus") To request a reload for all of your widgets: WidgetCenter.shared.reloadAllTimelines()

Members (8)

get · iOS 26.0+

currentPushInfo

TypeScript
get currentPushInfo(): Promise<(WidgetPushInfo) | null>
Swift declaration
var currentPushInfo: WidgetPushInfo? { get async }

Provides the current push information for widget reloads and relevance refreshes. May be nil if the token has not completed generation, or if no widgets have been configured for push.

method · iOS 14.0+

reloadTimelines

TypeScript
reloadTimelines(kind: string): void
Swift declaration
func reloadTimelines(ofKind kind: String)

Reloads the timelines for all widgets of a particular kind. - Parameter kind: A string that identifies the widget and matches the value you used when you created the widget's configuration.

method · iOS 14.0+

reloadAllTimelines

TypeScript
reloadAllTimelines(): void
Swift declaration
func reloadAllTimelines()

Reloads the timelines for all configured widgets belonging to the containing app.

method · iOS 18.0+

invalidateRelevance

TypeScript
invalidateRelevance(kind: string): void
Swift declaration
func invalidateRelevance(ofKind kind: String)

Mark the relevance for a kind as invalid. Call this function when the relevance returned for a widget has changed and needs to be reloaded. Marking relevance as invalid causes the system to call, at a later time, the `relevance` function on the timeline provider that matches the specified kind. - Parameter kind: A string that identifies the widget and matches the value you used when you created the widget's configuration.

method · iOS 18.0+

currentConfigurations

TypeScript
currentConfigurations(): Promise<Array<WidgetInfo>>
Swift declaration
func currentConfigurations() async throws -> [WidgetInfo]

Retrieves information about user-configured widgets.

method · iOS 14.0+

getCurrentConfigurations

TypeScript
getCurrentConfigurations(completion: ((arg0: SDKHandle) => void)): void
Swift declaration
@preconcurrency func getCurrentConfigurations(_ completion: @escaping @Sendable (Result<[WidgetInfo], any Error>) -> Void)

Retrieves information about user-configured widgets. - Parameter completion: A completion handler called when the widget information is available.

method · iOS 16.0+

invalidateConfigurationRecommendations

TypeScript
invalidateConfigurationRecommendations(): void
Swift declaration
func invalidateConfigurationRecommendations()

Invalidates and refreshes the preconfigured intent configurations for user-customizable widgets. In watchOS, call this function when your app receives new data for preconfigured widgets you'd like to appear in the list of available watch complications. > Note: On platforms that offer a dedicated user interface for configuring widgets — for example, iOS or macOS — `invalidateConfigurationRecommendations()` is inactive.

get · iOS 14.0+

shared

TypeScript
static get shared(): WidgetCenter
Swift declaration
static let shared: WidgetCenter

The shared widget center.

Skipped declarations

No declarations were skipped in this snapshot.

All WidgetKit types →