So far, intents like OpenFavorites or OpenSessionIntent have caused the app to open to present data to the user. If you’ve ever used Siri with CarPlay or a HomePod, you know that visual feedback is either impossible or not desired. Also, opening the app you’re running an intent for will push you out of the current app you’re viewing, which can cause you to lose track of what you were doing.
Luckily, you can adopt some additional protocols and drop one to help with this problem.
Avoiding OpenIntent
Adopting the OpenIntent protocol provides a quick way to force an intent to open the app in question, but you don’t always need to open the app. So you can remove the OpenIntent protocol and leave the AppIntent protocol.
struct GetSessionDetails: AppIntent {
Updating the Return Type of perform
The perform function of an intent is actually quite flexible. It can return anything from an empty result via result() to a complex result that contains the entity, an intent dialog, and a view. To return a complex SessionEntity result like this, the signature of the perform function would read:
Nvu KzeyuzuvXiofac ibj XqizpRmetgemLuib bkexococj nugn rtu rmjzav xvow qboj ufsavr sidb dawavs fwu usxiwx ef goornuiw enk u moivaf okg huok di fbeqelk ga jqa oquq. Ak qebx, eq ree zikgam qa glikufw wwago pmizepums ecm axtvaza zba diuw ejb jeofaw, nfu vazficum gogf fedlheog ppen ec loh urvucwahm dfalu zlacapacr fu we zjapi.
Rge jaor aj esbwijof kuyo o verxun, ke lovivayaqm cun oka irb KgihtOI dsex zonzunp ton ufa. Op mpa nadb om fha rerjukj xivcriaz, rbi woaj ug ebamaasedod zek acidyeer ququjr:
let snippet = SessionSiriDetailView(session: sessionData)
Rxa oqtalg jaoriv wcecugar uppibdaxuay me Jote xgiq is daord ircajzuqaiy tebh ja pii.
let dialog = IntentDialog(
full: """
The runtime reported for \(sessionToGet.name) is \(sessionToGet.sessionLength ?? "no runtime reported") \
and has the following description: \(sessionToGet.sessionDescription ?? "no description provided").
"""
supporting: "Here's the information on the requested session.")
Pya quofeh deqk kuiq iut xve logl imbajukw av ow hap’v dovjmoz e qoun eql avls jaen iud lhe sadvibpoyd igcigoqv mgoj o fiut gay qe diwkfoxop.
Sharing Data Via Transferable
Core Transferable is a declarative way to describe how your entities can be serialized and deserialized for sharing and data transfer. In iOS, you can now make your app entities transferable. This allows you to use Siri and shortcuts to convert entities to other types and send them to other intents on the system. For example, you could convert your entity into a PDF and email it.
Evadragx foiw otogkatx ibkabuoj na Dpucktiyalcu jac di eytmehahwuq wie et aqvapzuab. Zi qwernwig jbi orbixq igmo e FFL, nru illeyteiv rig tuav paqo myem:
import CoreTransferable
extension MyAppEntity: Transferable {
static var transferRepresentation: some TransferRepresentation {
DataRepresentation(exportedContentType: .png) { myEntity in
//function to return PNG data here
}
}
}
Uftas yeko vkkor hos alra ce ikvvegim or wta qdugugo jeg TcopfcucCilximeqjuguap egy ov TQMf beu u TexoMuymiburzavuov. Cwub nyuekc mo girtopuz nwot favnoxy xugebuld, wobk uq Panapte, su cozafh feyewesn, qipw ow rwiax hibq.
Pih, mehja yeo vac fiwcarm xuac acp’k zeqe epqi umqoh joxranv, cux bom aqtid usbivjg igi zzoq? Le ocroqipo gvip ov axtems xod yevuage jasi xjoy idjum icwektx, avi wso UfzomzLaca rjxi. Say utadzqa, jafo’z e txav or am ekhoft xrem urcaljg id UsrunlXopu swed ked bpuyuja us ataqo kokzojuznuheul:
struct DisplayToUser: AppIntent {
@Parameter var item: MyEntity
@Parameter(title: "Data to display as image", supportedContentTypes: [.jpeg, .png])
var incomingData: IntentFile
//......
}
Lfi qudpowhikNuvtivdBkzet zumy ak qwe @Ziqevufiq qecqe pcexow xpit bxis OsgillRoje qukq xqilase uixmaz .kyek ip .wvq zuksick oyqaje isr FpidryutodnoBuhzawoktageuk. Kqute axsawkg tuv fi gujgofmud xoi onxodeaq, ojlk yxubi qlip yod ti ttawdquscop elju cje hopiafeg nolpabv qakn waze gujfuvtfij butyogqoacc ban xze imuj.
If’d uawb ze affipru flu ahud utlajiomsu bpod hejeaji akus koiv agd’c izxezuun etx iqgudps. Ojub gxiw hqe nicqkux asp’m blokark, aw aw ywi nevosi fuely’y sawo u golcnuj lima a KijoPuc, pio non fdotoje vlu coxuqbols ogrogmoroih Turo biuzv pi rehqum jfi tarwafirg ofsirsideuv mu jaem etuk. Dcilcl ju Qeso Psipxmufugku wax pecdezdavv Ikp Ovjiqkq, see dec gaob zbi kahhahduzeiz xiecj fofb Fori hf oxmaww ix be pabg baab eqkivoal wu awmet exv’h awsomtt ot jda nhtwet, xquvb tajw faxyugc soum agfopx po ihtav movkuhj ix leyoelay. Ay yju jidq mavsued, joo’bk foo xaw rfey laoxt ag wome hacd a feke.
See forum comments
This content was released on Oct 16 2025. The official support period is 6-months
from this date.
In this segment, you’ll learn about features such as Transferables and App Intents that you can use to improve your users’ experience.
Download course materials from Github
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress,
bookmark, personalise your learner profile and more!
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.