App Intent parameter type file

Hi,

I started to implement my first App Intent. I have added a parameter (@Parameter). But what data type do I need do set to get a file as input?

Answered by patrick in 725652022

I have solved the problem by myself. IntentFile was the correct type.

@Parameter(title:"File")
var file: IntentFile

It looks like this should be possible. To I need to set something special on the @Parameter property wrapper?.

Accepted Answer

I have solved the problem by myself. IntentFile was the correct type.

@Parameter(title:"File")
var file: IntentFile

That may not get you all the way there unless you support all file types. Something like the following will only accept images, for example.

@Parameter(title: "Image", description: "Image to copy", supportedTypeIdentifiers: ["public.image"], inputConnectionBehavior: .connectToPreviousIntentResult) var file: IntentFile
App Intent parameter type file
 
 
Q