TransferRepresentation, AppEntities and AppIntents

Hi, I am trying to understand how this mechanism integrates with shortcuts (and i guess siri + apple intelligence in near future) and other apps.

Basic setup is an AppEntity that implements 'transferable' and is returning a DataRepresentation of 'text'.

got an AppIntent returns a one of the 'entitities' and I'm simply trying to pass the result to initially email or another app using shortcuts. even with canned 'hello world' string being marshalled into DataRepresentation(.text) I am not seeing anything in usual system targets like email, messages, notes. It opens the app ok, but no text is present. (note: if I use an incorrect DataRepresentation type with email it'll flat out fail saying 'not correct 'text' type)

What exactly do I need to do here and is there any example code I can look at?

thanks

Hey @mvc2522 – I've been trying to better understand how transferable works with App Intents too. Here's something I discovered.

In the second action block (i.e. send email), tap on the AppEntity instance that's been passed in from the first action block (your app's AppIntent action). A sheet pops up, with some configuration options related to the type. The Type selector likely defaults to your entity type.

And below this, there is a parameter selector that once again lists your type (selected by default) followed by all the @Parameter from your app entity. If you tap the parameter containing your string and re-run the shortcut, it should get passed into the email. I'm not sure the purpose of entity type the default - in my testing I had similar behavior to you - a new email window opening up that was blank.

Alternatively, based on the transferable conformance you added, try changing the Type selector from your entity's type to Text and re-run the shortcut. This should work too.

I posted about something similar in this thread but haven't gotten any guidance yet. Let me know what you discover!

TransferRepresentation, AppEntities and AppIntents
 
 
Q