One Logo Pool Ball
AppIntents · IOS API REFERENCE

IntentExecutionTargets

struct · iOS 27.0+ · SDK 27.1

struct IntentExecutionTargets

A set of options that describes which process performs an intent or entity query. If you reuse intents and entities between your app, widget extension, or App Intents extension by using a Swift package or framework, the system may perform your ``AppIntent`` or ``EntityQuery`` from the app or App Intents extension. By default, the system performs an intent or entity query using any available target. Use `IntentExecutionTargets` to tell the system which targets can perform your ``AppIntent`` or ``EntityQuery``. For example, a browser app might represent browser tabs and bookmarks as app entities and offer app intents to add a bookmark or open a browser tab. Adding a bookmark might be an action that can happen while the app isn't visible, so performing the action in the App Intents extension makes sense. However, opening a new tab makes sense only when the app is visible, requiring the system to perform the intent in the app's process. The following example shows an app intent that the system performs in either the main app or the app intents extension: ```swift struct MyIntent: AppIntent { static var allowedExecutionTargets: IntentExecutionTargets { [.main, .appIntentsExtension] } } ```

Members (10)

get · iOS 27.0+

appIntentsExtension

TypeScript
get appIntentsExtension(): IntentExecutionTargets
Swift declaration
static var appIntentsExtension: IntentExecutionTargets { get }

The system performs the intent or query in your app intents extension.

method · iOS 27.0+

formIntersection

TypeScript
formIntersection($self: IntentExecutionTargets, other: IntentExecutionTargets): void
Swift declaration
mutating func formIntersection(_ other: IntentExecutionTargets)

Removes the elements of this set that aren't also in the given set. In the following example, the elements of the `employees` set that are not also members of the `neighbors` set are removed. In particular, the names `"Alicia"`, `"Chris"`, and `"Diana"` are removed. var employees: Set = ["Alicia", "Bethany", "Chris", "Diana", "Eric"] let neighbors: Set = ["Bethany", "Eric", "Forlani", "Greta"] employees.formIntersection(neighbors) print(employees) // Prints "["Bethany", "Eric"]" - Parameter other: A set of the same type as the current set.

get · iOS 27.0+

widgetKitExtension

TypeScript
get widgetKitExtension(): IntentExecutionTargets
Swift declaration
static var widgetKitExtension: IntentExecutionTargets { get }

The system performs the intent or query in a widget extension.

method · iOS 27.0+

formSymmetricDifference

TypeScript
formSymmetricDifference($self: IntentExecutionTargets, other: IntentExecutionTargets): void
Swift declaration
mutating func formSymmetricDifference(_ other: IntentExecutionTargets)

Removes the elements of the set that are also in the given set and adds the members of the given set that are not already in the set. In the following example, the elements of the `employees` set that are also members of `neighbors` are removed from `employees`, while the elements of `neighbors` that are not members of `employees` are added to `employees`. In particular, the names `"Bethany"` and `"Eric"` are removed from `employees` while the name `"Forlani"` is added. var employees: Set = ["Alicia", "Bethany", "Diana", "Eric"] let neighbors: Set = ["Bethany", "Eric", "Forlani"] employees.formSymmetricDifference(neighbors) print(employees) // Prints "["Diana", "Forlani", "Alicia"]" - Parameter other: A set of the same type.

get · iOS 27.0+

main

TypeScript
get main(): IntentExecutionTargets
Swift declaration
static var main: IntentExecutionTargets { get }

The system performs the intent or query in the main app process.

get · iOS 27.0+

default

TypeScript
get default(): IntentExecutionTargets
Swift declaration
static var `default`: IntentExecutionTargets { get }

The system performs the intent or query in any available target.

init · iOS 27.0+

init

TypeScript
init(rawValue: number): IntentExecutionTargets
Swift declaration
init(rawValue: Int)

Creates a new option set from the given raw value. This initializer always succeeds, even if the value passed as `rawValue` exceeds the static properties declared as part of the option set. This example creates an instance of `ShippingOptions` with a raw value beyond the highest element, with a bit mask that effectively contains all the declared static members. let extraOptions = ShippingOptions(rawValue: 255) print(extraOptions.isStrictSuperset(of: .all)) // Prints "true" - Parameter rawValue: The raw value of the option set to create. Each bit of `rawValue` potentially represents an element of the option set, though raw values may include bits that are not defined as distinct values of the `OptionSet` type.

get · iOS 27.0+

rawValue

TypeScript
getRawValue($self: IntentExecutionTargets): number
Swift declaration
var rawValue: Int

The corresponding value of the raw type. A new instance initialized with `rawValue` will be equivalent to this instance. For example: enum PaperSize: String { case A4, A5, Letter, Legal } let selectedSize = PaperSize.Letter print(selectedSize.rawValue) // Prints "Letter" print(selectedSize == PaperSize(rawValue: selectedSize.rawValue)!) // Prints "true"

set · iOS 27.0+

rawValue

TypeScript
setRawValue($self: IntentExecutionTargets, value: number): void
Swift declaration
var rawValue: Int

The corresponding value of the raw type. A new instance initialized with `rawValue` will be equivalent to this instance. For example: enum PaperSize: String { case A4, A5, Letter, Legal } let selectedSize = PaperSize.Letter print(selectedSize.rawValue) // Prints "Letter" print(selectedSize == PaperSize(rawValue: selectedSize.rawValue)!) // Prints "true"

method · iOS 27.0+

formUnion

TypeScript
formUnion($self: IntentExecutionTargets, other: IntentExecutionTargets): void
Swift declaration
mutating func formUnion(_ other: IntentExecutionTargets)

Adds the elements of the given set to the set. In the following example, the elements of the `visitors` set are added to the `attendees` set: var attendees: Set = ["Alicia", "Bethany", "Diana"] let visitors: Set = ["Diana", "Marcia", "Nathaniel"] attendees.formUnion(visitors) print(attendees) // Prints "["Diana", "Nathaniel", "Bethany", "Alicia", "Marcia"]" If the set already contains one or more elements that are also in `other`, the existing members are kept. var initialIndices = Set(0..<5) initialIndices.formUnion([2, 3, 6, 7]) print(initialIndices) // Prints "[2, 4, 6, 7, 0, 1, 3]" - Parameter other: A set of the same type as the current set.

Skipped declarations

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

IntentExecutionTargets.init(arrayLiteral:)

A variable number of Swift arguments is not supported.

All AppIntents types →