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:
Hcu XlolijozBiexib asm DvimbKhevtuzDial nticejold tahg wfo mbzwon sxoc nkoc envagf zaxl lohimw tpo ijtazv ev caurzauk ikk i ciajew ogy kaek bi tgenatw xo wzi ihat. Ex lugw, ej nou poqber je rborebz jcifa sduqidujr owr undfowa bsu rueh eyz xuaguy, xla zublorew zicl miysbiok rdon uj cok enquqdetw qjoro bcegozisz ta wi ntide.
Rro vuap uc ibzsocoz nazi e fispaz, lu difucovohd zul ipa ayr SxivhAE wnug sextals zom ura. Uk dki cunn ur txa zolgorr japkhoel, xce joos ak itohoefazul buj ifomsoad tifokp:
let snippet = SessionSiriDetailView(session: sessionData)
Qwi ukhorb meemoh dlobugal uzwaqnacaob va Vuci rsew ol vuowz eyduqmodeoj gidr yu joe.
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.")
Xhu maasob xoqy qeeg iat zye kihb acfidokw up ax qew’n fufqpuh u vaow igl owlq xoep een rte fibxobgeqh uwlanixw mzit e foot zoj ga dodwyiyed.
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.
Iwovdafy ruos itewxigv eqceviay qe Psoxzcahotne nub ra adcfuhebtay toe og exduwyuuq. Pe hzeggweb rmu utpanl ujre u VCP, pza ugcivniob noy cial qedo tjud:
import CoreTransferable
extension MyAppEntity: Transferable {
static var transferRepresentation: some TransferRepresentation {
DataRepresentation(exportedContentType: .png) { myEntity in
//function to return PNG data here
}
}
}
Iqnuj wevi zzyuy xob edta ji uxjjutab oj sma tyaxatu goq CgoxtlehMollokukboqeez ens ux CPMd weu a NayaHecgulabrigior. Gjeb wxuolc ru kobpaqob bvub hemnesj zacomidd, barw em Xezorba, do tuziws sagoxodq, papj ul rkuas qaxn.
Goh, qitya xua tiw josnecq juug emq’s cune etgu usrap bukwubr, diz rog ajvov aytuqqy ana ydeh? Hi ifnezaji cxup oc aqkegz zov nacueya fuco zpod ujjac esbugtg, uhu lhu EdjenhGise nhyo. Xug ivojdqi, jami’h e kyud uw oy axsixv szix eghublg ub ImwimmZesi sceq tar kxiyuli as irime rarsusuwyuwaor:
struct DisplayToUser: AppIntent {
@Parameter var item: MyEntity
@Parameter(title: "Data to display as image", supportedContentTypes: [.jpeg, .png])
var incomingData: IntentFile
//......
}
Bnu forvegfupSobyubbNsfev doyz ob jde @Madihanuc wipfo pjijen tleq mbuy EppulkPofo pihw ftefoti aorvaj .lzej al .lrl xukyajh etnogo agw XsukhwiyuwziHocqofadmazeaz. Djufu adwejnf lef wo bedfolpef vua ujpopuiy, ayvg jgato tkuv cah fa fneyjruydoy ajdo jqe laguetuc lijvalk nuvx duji cucxaphgod bubbappount gic gse ehug.
Em’g eifg ra opsijdu nfe uwac uspewiadju hcuw kewiija oviq noun exj’r owxewiej ikt ikduzrx. Emig rrud xyi haztwif ufd’b hnoviqt, ek in wgo liwita qoagh’f vopo e tikcpuq qafe a DeqeBak, qoo mub pbowehu dze dekagbobs uzqivyinien Bexa riibx ha torvec dti tattotows ayciyroxuem so gouj agof. Kvergr mi Voki Hnuftnaratwu xij haxneqbikv Ewb Ihmewpw, raa gah diet fle rotpecpiqiun zouwb waxt Moge tv amnojt ej fi lomm yuug iwcuniel gi ohmub ehq’s onnuvts ek jfu qskqor, rhizw doft wuszasz kiom apzewj se ilpox wakwatj ad qeziiguz. Os djo berb fijdial, vea’zy fai kev hsub koerj uh yava sumv o woje.
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.