One Logo Pool Ball
AppIntents · IOS API REFERENCE

WidgetConfigurationIntent

protocol · iOS 17.0+ · SDK 27.1

protocol WidgetConfigurationIntent : AppIntent

An interface for configuring a WidgetKit widget. The parameters of the intent define the configuration options for your widget. The system uses the intent's title and description for the display name and description of the widget if those values aren't set explicitly on the <doc://com.apple.documentation/documentation/widgetkit/appintentconfiguration>. ```swift import AppIntents struct FavoriteBook: WidgetConfigurationIntent { static var title: LocalizedStringResource = "Favorite Book" static var description = IntentDescription("Shows a picture of your favorite book!") @Parameter(title: "Title", default: "The Swift Programming Language") var title: String @Parameter(title: "Author", default: "Apple Inc.") var author: String } ``` Use ``AppIntent/parameterSummary-4vgic`` to configure the order of the parameters in the configuration UI, as well as dynamic presentation such as using the value of one parameter to determine whether to show or hide another. ```swift enum RefreshInterval: String, AppEnum { case hourly, daily, weekly static var typeDisplayRepresentation: TypeDisplayRepresentation = "Refresh Interval" static var caseDisplayRepresentations: [RefreshInterval : DisplayRepresentation] = [ .hourly: "Every Hour", .daily: "Every Day", .weekly: "Every Week", ] } struct FavoriteSoup: WidgetConfigurationIntent { static var title: LocalizedStringResource = "Favorite Soup" static var description = IntentDescription("Shows a picture of your favorite soup!") @Parameter(title: "Soup") var name: String? @Parameter(title: "Shuffle", default: true) var shuffle: Bool @Parameter(title: "Refresh", default: .daily) var interval: RefreshInterval static var parameterSummary: some ParameterSummary { When(\.$shuffle, .equalTo, true) { Summary { \.$name \.$shuffle \.$interval } } otherwise: { Summary { \.$name \.$shuffle } } } } ``` When using this protocol, you don't need to provide an implementation for ``AppIntent/perform()``. You can, however, still implement `perform()` to use the same implementation for both widget configuration and as an actionable intent. For more information, refer to the <doc://com.apple.documentation/documentation/widgetkit/emoji-rangers-supporting-live-activities-interactivity-and-animations> sample code project's `EmojiRangerSelection` structure and <doc://com.apple.documentation/documentation/widgetkit/appintenttimelineprovider>.

Members (1)

method · iOS 17.0+

perform

Swift declaration
func perform() async throws -> Self.NeverResult

Skipped declarations

No declarations were skipped in this snapshot.

All AppIntents types →