AppIntents @OptionalParameter doesn't exist?

according to: https://developer.apple.com/documentation/appintents/appintent

one should be able to create an optional parameter to a shortcut with "@OptionalParameter". But it seems that macro doesn't exist anywhere outside of that 1 web page.

Is it not implemented?

Answered by Glacials in 786400022

The documentation should be updated, it seems optional parameters are inferred based on Swift optionality via ?.

Replace this:

@OptionalParameter(title: "Quantity") var quantity: Int?

with this:

@Parameter(title: "Quantity") var quantity: Int?

The user won't be required to specify the parameter.

Accepted Answer

The documentation should be updated, it seems optional parameters are inferred based on Swift optionality via ?.

Replace this:

@OptionalParameter(title: "Quantity") var quantity: Int?

with this:

@Parameter(title: "Quantity") var quantity: Int?

The user won't be required to specify the parameter.

AppIntents @OptionalParameter doesn't exist?
 
 
Q