One Logo Pool Ball
WidgetKit · IOS API REFERENCE

AppIntentRecommendation

struct · iOS 17.0+ · SDK 27.1

struct AppIntentRecommendation<Intent> where Intent : WidgetConfigurationIntent

An object that describes a recommended intent configuration for a user-customizable widget. By adding a custom App Intent to your project and using an <doc:AppIntentTimelineProvider>, you allow users to configure widgets to show data that's most relevant to them. Some platforms don't have a dedicated user interface to configure all of your intent parameters. For example, watchOS doesn't offer a dedicated user interface to configure data that appears on a complication. Use intent recommendations in watchOS to offer preconfigured complications that show data that's most relevant to the user. > Note: On platforms that offer a dedicated user interface for configuring widgets — for example, iOS or macOS — `AppIntentRecommendation` is inactive. For example, say you develop a game app that allows users to view their in-game character. With intent recommendations, you can recommend an intent configuration for a watch complication that displays character information. The following example shows a function to create a list of recommended configurations for a game widget that shows current energy levels for a game character. public func recommendations() -> [AppIntentRecommendation<DynamicCharacterConfiguration>] { CharacterDetail.availableCharacters.map { character in let intent = DynamicCharacterConfiguration() intent.hero = Hero(identifier: character.name, display: character.name) return AppIntentRecommendation(intent: intent, description: Text(character.name)) } }

Members (0)

This type has no directly callable members in this snapshot. See the framework’s skipped declarations for unsupported APIs.

Skipped declarations

4 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

AppIntentRecommendation.init(intent:description:)

This declaration needs Swift generic type arguments. (no canonical witness for Intent)

AppIntentRecommendation.init(intent:description:)

This declaration needs Swift generic type arguments. (no canonical witness for Intent)

AppIntentRecommendation.init(intent:description:)

This declaration needs Swift generic type arguments. (no canonical witness for Intent)

AppIntentRecommendation.init(intent:description:)

This declaration needs Swift generic type arguments. (no canonical witness for Intent)

All WidgetKit types →