@available(iOS 12, *) public protocol IntentAction : IntentBackgroundAction
Adopt this protocol when implementing an action that fulfills a Siri Intent via an Intent Extension
NoteSee https://bugs.swift.org/browse/SR-10831 for why this is so ugly re: defaulting the associated types. The type inference should see the constraints fully satisfy the associated types but it doesn’t, so we have to also specify the associatedtype so that conforming types can compile
The type of the
INIntent. This is the Xcode-generated response type produced from your intent definition configuration.
Implement this function if the Action supports a Siri Intent for Shortcuts. This is used to register a shortcut intent with Siri if you have the
This call can throw if the input fails to be converted to an intent and this is important to your app. You can also return nil to simply suppress creation of an intent for the given input.
- param input: The input instance. Read properties of this to create an instance of the intent type.
- return: The intent that should trigger this action for the given input, or nil to indicate no intent is available
@available(iOS 12, *) static func intent(withInput input: InputType) throws -> IntentType?
Implement this function to create a valid input for the action from and instance of the
IntentType, used when performing the action for an intent.
This call can throw if the intent fails to be converted to an input and this is important to your app. You can also return nil to simply suppress creation of an intent for the given input.
- param intent: The intent instance. Read properties of this to create an instance of the input type.
- return: The input to use to perform the action for this intent
@available(iOS 12, *) static func input(fromIntent intent: IntentType) throws -> InputType?