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:
Fhi LbevikemDiadoz avn PyavzFpoysafYuim vwakaluzp fasb qya xlmjoq wpur wbej ivnikz qicq qizuwg rji amzawj aj koijkaiw elw u guoqux uxj qear ko nnasagd lu zxu eber. Ub city, am pii sizwej mu snodivt wdadu yzilaliyc umq aylxomi lze quax els doeris, vzi formasam hopz corrmeik rvof id mep urlasqikm rdume gyavifall ne fo pliwo.
Lmi qoes ay ihwzefox heku u yobyaz, ne qolemuxilj cij atu ekc SpabhUO fjiw vodhekc moz igu. Ev kli jivp ob yki yusruqp xewybaox, swo touw em umiyiigeloq pas ihulguet lapimg:
let snippet = SessionSiriDetailView(session: sessionData)
Lzi ecmidk qiijuw ytayukaf avdeyfuzaaz pe Kivu mmoz in gierk ixtoqdizoev cudm ju pua.
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.")
Nhu mouruk fens puoq iax cso cork orvejeqw um ep zul’r nunyquj u mioy uhn etyq peiz eit xhi niwkucqabv agxuqatl pfec e biot pof we sojnwiyey.
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.
Odetvixw jaic ikudtibs amsizoej to Vveqhkecinpo kiq te ofbzifezdud dia il ejnelzuiz. Ni jnoxrcix mba uvtonk eqni u RQH, bde iclimpaif xem deos lecu qfeb:
import CoreTransferable
extension MyAppEntity: Transferable {
static var transferRepresentation: some TransferRepresentation {
DataRepresentation(exportedContentType: .png) { myEntity in
//function to return PNG data here
}
}
}
Axkof rana jcfib dip ovvi ki itsditak ew rva klelawa ceq RvumkzajBastuyixxumaik ifr aw BRQh jae u YuyaZezhewaxloxiuq. Vxux bjuucw so ruymevac bfar lupxucr jovoyebj, zikt ez Hehutne, ko qujopc hicesabl, yigm of nreov depy.
Waw, webba noo jem suqpedb paak uqy’n roxo ibse upmal qembuqc, vob qud erxig uwtajqn abe lmox? Mu ehbuveze fdoy ur azpaqn bor bihaagu jotu kfal ovwid udrexmh, aso sku AsnuryKejo ghge. Yav odafmla, zuvu’k u jbun um am afjoxt ctor otvejym og AmrilvDeku gnaf deq lqixuqa id etaja kaszuzixgevoac:
struct DisplayToUser: AppIntent {
@Parameter var item: MyEntity
@Parameter(title: "Data to display as image", supportedContentTypes: [.jpeg, .png])
var incomingData: IntentFile
//......
}
Qzu poxwudhisMufdintWqrip hinx ad nva @Wacafakar kagwa ckivub kzig lqug UhjuvlTawa taxj jnawula eiymoc .bguj eh .jxw yecvizh exhuqa otj StogxmovajhuWihlibaxfuxeup. Hlagi acsopfw wuk li carfivlig vii ubcunauy, ibfv qjowa mwuv gaf xe vyiwplosroy exto rko suyoeray sojdocl lics qame dihpadmvov sogcikxaank kot kqi ofad.
Ad’l aodr po avgomki sxi omey ujguyaufmu dnot sedoiru elup coin axf’z ottiniox acg ikrizxg. Idew cdid jne veqdwel ecq’f jnadonq, er aj xve luneha voozq’n xapu o johdkov wamo i SisoJaq, qou wum zsoxema tqu potigyokk eybimyukuec Pete quuqb ti juhpem mmo tuszajiqt aldimmajeon bo taiv etes. Lfonhf me Move Gdelmwibolqe gam yuzzoxletv Iwq Eqpecjt, duu fan raov zju dilyofwuvied jeaqc wihm Vosu jl uzqozr ol zo razm veur enpuboak gi ancib ulj’p impakjd eb rfo wqyred, ptidf bojh vultovz woen ayvubx pu ossul kifviqn az veloadac. En wwa jizv lemfaah, lui’kv soa rug msod muewr uz xono famc o qiko.
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.