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?

Accepted Reply

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

@Parameter(title:"File")
var file: IntentFile
  • I tried this but I receive a strange compilation error error: Invalid Swift parseable output message (malformed JSON): 1``

Add a Comment

Replies

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

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

@Parameter(title:"File")
var file: IntentFile
  • I tried this but I receive a strange compilation error error: Invalid Swift parseable output message (malformed JSON): 1``

Add a Comment

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
Post not yet marked as solved Up vote reply of J0hn Down vote reply of J0hn
Add a Comment