Skip to content

param helpers

Every param.* helper returns a ParamSpec describing a single App Intent parameter. You use them inside the params object of defineIntent().

Type mapping

HelperSwift typeNotes
param.string(desc)String
param.int(desc)Int
param.double(desc)Double
param.float(desc)Float
param.boolean(desc)Bool
param.date(desc)Date
param.duration(desc)Measurement<UnitDuration>
param.url(desc)URL
param.number(desc)IntDeprecated — alias for param.int, removed in 1.0.0

Options

Every helper accepts a second options argument:

param.string("Body of the message", {
optional: true,
default: "Hi!",
});
OptionTypeDefaultWhat it does
optionalbooleanfalseMakes the parameter non-required
defaultTDefault value (only valid if optional: true)

Numeric precision

Axint distinguishes between Int, Double, and Float because App Intents users sometimes need integer constraints (page numbers, quantities) and sometimes need full floating point (GPS coordinates, temperatures).

params: {
pageNumber: param.int("Which page"),
latitude: param.double("Latitude in degrees"),
temperature: param.float("Temperature in Celsius"),
}

All three compile to different Swift types, not one collapsed NSNumber.

Deprecated: param.number

v0.1.x only had param.number, which always mapped to Swift Int. That turned out to be wrong for anything GPS-related, so v0.2.0 split it into int, double, and float. param.number is preserved as a deprecated alias and will be removed in v1.0.0.