One Logo Pool Ball
WidgetKit · IOS API REFERENCE

ControlCenter

class · iOS 18.0+ · SDK 27.1

class ControlCenter

An object you use to access configuration information for controls and reload them. ControlCenter provides information about user-configured controls, such as their push information. For additional information about offering controls that allow people to perform app actions; -- for example, in Control Center on iPhone -- refer to <doc:Creating-controls-to-perform-actions-across-the-system>. For more information about offering user-configured controls, refer to <doc:Adding-refinements-and-configuration-to-controls#Add-configuration-to-a-control>. ### Access configured control information To get a list of user-configured controls, use <doc:ControlCenter/currentControls()>. This property provides an array of <doc:ControlInfo> objects containing the following information: struct ControlInfo { public let kind: String public func configurationIntent<Intent: ControlConfigurationIntent>(of intentType: Intent.Type = Intent.self) -> Intent? public var pushInfo: ControlPushInfo? } The `kind` string matches the parameter you use when defining the control type. If your control uses a <doc:AppIntentControlConfiguration>, the ``ControlInfo/configurationIntent(of:)`` function provides the custom intent containing the user-customized values for each individual control. If your control receives push notification updates, ``ControlInfo/pushInfo`` returns the push token you use to update it. For more information about updating controls with WidgetKit push notifications, refer to <doc:Updating-controls-locally-and-remotely>. ### Request a reload of your controls Changes in your app’s state may affect a control's state. When this happens, you can tell `ControlCenter` to reload the template for either a specific kind of control or all controls. For example, someone might press a button in your app that changes state shared by a control. The app should reload that control for its display to reflect the new state. You don't need to reload controls in response to push notifications. The system reloads any controls that receive push notification updates on your behalf. If you only need to reload a certain kind of control, you can request a reload for only that kind. For example, in response to the user toggling an appliance on or off, you could request a reload for only the appliance widgets: ControlCenter.shared.reloadControls(ofKind: "com.myhome.appliancepower") To request a reload for all of your controls: ControlCenter.shared.reloadAllControls()

Members (4)

method · iOS 18.0+

reloadControls

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

Reloads the templates for all controls of a particular kind. - Parameter kind: A string that identifies the control and matches the value you used to define the control.

method · iOS 18.0+

currentControls

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

Retrieves information about user-configured controls.

method · iOS 18.0+

reloadAllControls

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

Reloads the templates for all configured controls belonging to the containing app.

get · iOS 18.0+

shared

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

Skipped declarations

No declarations were skipped in this snapshot.

All WidgetKit types →