Scripting allows you to define custom iOS Intents using an intent.tsx
file. These scripts can receive input from the iOS share sheet or the Shortcuts app and return structured results. With optional UI presentation, you can create interactive workflows that process data and deliver output dynamically.
intent.tsx
to the project.Tap the project title in the editor’s title bar to open Intent Settings, then select supported input types:
This configuration enables your script to appear in the share sheet or Shortcuts when matching input is provided.
Inside intent.tsx
, use the Intent
API to access input values.
Property | Description |
---|---|
Intent.shortcutParameter |
A single parameter passed from the Shortcuts app, with .type and .value fields. |
Intent.textsParameter |
Array of text strings. |
Intent.urlsParameter |
Array of URL strings. |
Intent.imagesParameter |
Array of image file paths (UIImage objects). |
Intent.fileURLsParameter |
Array of local file URL paths. |
Example:
Use Script.exit(result)
to return a result to the caller, such as the Shortcuts app or another script. Valid return types include:
Intent.text(value)
Intent.attributedText(value)
Intent.url(value)
Intent.json(value)
Intent.file(value)
or Intent.fileURL(value)
Example:
Use Navigation.present()
to show a UI before returning a result. You can render a React-style component and then call Script.exit()
after the interaction completes.
Example:
If a script supports a specific input type (e.g., text or image), it will automatically appear as an option in the iOS share sheet:
You can call scripts from the Shortcuts app with or without UI:
Steps:
Intent
PropertiesProperty | Type | Description |
---|---|---|
shortcutParameter |
ShortcutParameter |
Input from Shortcuts with .type and .value . |
textsParameter |
string[] |
Array of input text values. |
urlsParameter |
string[] |
Array of input URLs. |
imagesParameter |
UIImage[] |
Array of image file paths or objects. |
fileURLsParameter |
string[] |
Array of input file paths (local file URLs). |
Intent
MethodsMethod | Return Type | Example |
---|---|---|
Intent.text(value) |
IntentTextValue |
Intent.text("Hello") |
Intent.attributedText(value) |
IntentAttributedTextValue |
Intent.attributedText("Styled Text") |
Intent.url(value) |
IntentURLValue |
Intent.url("https://example.com") |
Intent.json(value) |
IntentJsonValue |
Intent.json({ key: "value" }) |
Intent.file(path) |
IntentFileValue |
Intent.file("/path/to/file.txt") |
Intent.fileURL(path) |
IntentFileURLValue |
Intent.fileURL("/path/to/file.pdf") |
Script.exit()
to properly terminate the script and return a result.Navigation.present()
is awaited before calling Script.exit()
.queryParameters
when launching scripts via URL scheme if additional data is needed.