All Episodes

October 26, 2024 55 mins

App intents can be exposed in various ways beyond shortcuts, such as custom controls, focus filters, and spotlight actions. They enable users to perform specific actions without launching the app, making them more accessible and user-friendly. App intents can also be used to configure widgets, interact with hardware, and handle preferences, providing a seamless user experience across different platforms.

  • (00:00) - Introduction
  • (04:20) - App Intents
  • (06:57) - Become a member
  • (07:17) - Some examples
  • (16:31) - Action Centered Design
  • (17:52) - Get some Coffee
  • (20:04) - Examples from Barc
  • (21:39) - What makes a good App Intent
  • (27:26) - Creating an App Intent
  • (30:03) - Using Queries and Configuration
  • (32:36) - Get SetApp
  • (55:35) - Cocoatype.com
  • (55:38) - Support the podcast

Mentioned in this episode
The way we interact with apps is changing, so should the way they are designed
WWDC Developer video for getting started with App Intents

Become a Patreon member and help this Podcast survive
https://www.patreon.com/compileswift

Follow me on Mastodon
https://iosdev.space/@Compileswift

Thanks to our monthly supporters
  • flanker
  • Jay Wilson
  • Adam Wulf
  • bitSpectre
★ Support this podcast on Patreon ★
Mark as Played
Transcript

Episode Transcript

Available transcripts are automatically generated. Complete accuracy is not guaranteed.
Peter (00:02):
What's up, folks? Welcome to another episode of the
CompileSwift Podcast. This week,we are diving into some very
Swifty related things. We aregonna be talking about app
intents. But first of all,mister Geoff, how are you doing?

Geoff (00:18):
Yeah. Just been focusing on trying to get a major feature
release out for Bark, and thefeature that I'm working on
right now is Apple WalletExport. And so one thing that
that requires is actually doinga little bit of both front end
work and back end work. And soI've been doing some Swift on

(00:40):
the server with Hummingbird, andbuilding that out and having
that all deployed. And so nowI've I've got all of the back
end work done.
I've got it mostly, more orless, hooked up to my front end,
and now I need to do theunfortunate part that, everybody
hates me for of putting itbehind a paywall. So, you know,

(01:04):
not not letting people have thatfeature for free, unfortunately.

Peter (01:08):
I'll say, we should definitely talk about maybe
Hummingbird in that sometime.Folks, you may remember I'll put
a link in the show notes. Ourgood friend, Giannis, we did an,
I did an episode back in thosedays. I interviewed him, and we
should definitely talk aboutHummingbird. But I am curious,
how are you gonna put that intoproduction?
Presumably on some kind of Linuxbox or something?

Geoff (01:31):
I have a single VPS hosted by a service called
Hetzner that I run, and Ibasically just, have it in a
Docker container, and I pushthat up and have it running on
my server.

Peter (01:44):
Cool. You know, actually, I was thinking about this the
other day, and I should ask you.Is there a a good Docker
container that we can just spinup that has, you know, Swift on
the server and all of that stuffset up ready to run?

Geoff (01:59):
There is some great Docker containers for doing
Swift development. This wasactually one of my first viral
videos ever was Oh my god.Posting about how to do, Swift
on a non Mac, system by takingadvantage of Docker containers
and GitHub Codespaces. And sothere are some really nice

(02:23):
Docker images for doing Swiftdevelopment and also for
deploying Swift code. They havea little one of each.
And so, yeah, it's very easy toget started using Swift. Not
really able to use all ofApple's frameworks. You can use
Swift. You can use Foundation.You can use the built in stuff.
But, being able to use that onLinux or really from any machine

(02:46):
because you can run Docker andyou can run that as a virtual
image and run Linux there. So,yeah, being able to do Linux
development inside of theseDocker images. Yeah. The Swift
language foundation, whateveryou want to call them. They they
do a good job of providing somesome nice Swift Docker images.

Peter (03:06):
Cool. We should talk about that sometime because, you
know, I've played around withthem from a development
perspective, but I've I'vealways wondered and never looked
into it because I've neverneeded to. But, you know, oh, is
there, you know, what's a nicegood secure more than anything,
production one. So maybe we'lldo an episode on that sometime
as well. Yeah.
So, this week, I think I havefinally wrapped up the update

(03:31):
for Jobfinder tracker with theinitial resume features and a
and a bunch of other updates. Ihad a weird bug that you know,
when you had those bugs that yousay to yourself, is it me or is
this a genuine bug? And younever configure it out. So, I've
pushed it to TestFlight and itwas a weird it's that weird

(03:53):
scenario where you're usingCloudKit and that and you wonder
like, okay, is it taking acouple of seconds to pull down
the data or is something reallywrong? So, you know, maybe we'll
talk about that sometime, butI'm hoping to get that that out
this week.
Maybe next week, depends if Iget a chance to make the videos,
you know. So we'll see. Buteither way, it's like, gosh, I

(04:17):
wrote some code. I I feel proudof myself. Alright.
Yeah. Alright. Let's get intothe meat of this then. So, I'll
give a quick rundown of what appintents are from a high level,
and then I know you've actuallydone some, dare I say,
production work with appintents. So, you know, it's
definitely gonna be interestingthere.

(04:38):
But for those who don't know,they they've I would imagine
most developers have at leastheard of them. Right? Because
Apple likes to talk about them.But app intents. So what an app
intent is in a in a very broadway is it gives you the ability
to for for users in differentways and I'll I'll list a few in

(05:01):
a moment.
To get into your applications orpull data out. Basically,
interact with your applicationwithout necessarily having to
open the application every time.So for example, right, you know,
app if you wanna use appintents, you would use them for
things like, you'll see them on,you know, spotlight access.

(05:24):
Right? Widgets is probably avery popular one.
Siri is
another one I am sure everybody has encountered at
this point as far as a another one I am sure everybody
has encountered at this point asfar as a user, control center.
The one that I'm perhaps mostinterested in is the shortcut
actions because of all thepossibilities that opens up for
automated workflows between yourapps and other apps and all of

(05:47):
those kind of things. And, alongwith that of course, if you if
you want really want to, and youhave a need, you know, you've
got the good old action buttonthat as you said before we
started is really the run ashortcut kind of button for the
most part. And and we're nottalking about the new one.
Right?
We're not talking about thecamera control one. We're
talking about the The

Geoff (06:07):
camera control one.

Peter (06:08):
Yeah. Not that one. Not yet. We're talking about the
button that's been around for,gosh, what is it? 2 or 3
versions at this point of theiPhone?
At least 2. Right?

Geoff (06:17):
It it 2.

Peter (06:18):
2. It came

Geoff (06:19):
out with the iPhone 15.

Peter (06:20):
Okay. Right. So so, I mean, at a high level, that's
what app intents are. They're away to interact with your
application, let other peopleinteract with them. Like I say,
widgets and Siri are probablythe most well known ones, as far
as you've used them and probablyhaven't realized what it is, but
they're super useful.

(06:41):
But, you know, Geoff, go we'regonna dive into the details of
how you create them and so on.But, you know, go into a little
more about how you've used themand why we think this is, you
know, this is kind of the thinggoing forward. Right? Hey,
folks. If you like what you'rehearing in this podcast and you
wanna help this podcast tocontinue going forward and

(07:04):
having great guests and greatconversations, I invite you to
become a Patreon supporter.
You can go topatreon.comforward/compileswift,
where you will get ad freeversions of the podcast along
with other content.

Geoff (07:18):
So I would say that app intents are basically a way of
exposing a single atomic actionthat your app can do to the
system. And in so doing that,you can kind of take these
actions and combine them withother actions that your app does
or other actions that other appsdo or other actions, in fact,

(07:42):
that the system does, and usethem to kind of tie a bunch of
things together. And, yeah, Ihad originally started out
working with the most obvious,most visible form of app
intents, which is, of course,using them in the shortcuts app.
And what the biggest benefit andalso the biggest curse of doing

(08:08):
app intents with shortcuts isthat, of course, shortcuts is
very much a huge power userfeature. And so there's not a
lot of benefit to focusing onshortcuts as your app intense
target, because that's somethingthat really is only going to be
used by a very small portion ofyour users.

(08:31):
However, as I've explored moreinto app intense, and as I've
explored more into what they'recapable of, it turns out that
there are a lot of App Intenseis, like, kind of, at least in
my mind, and I think in a lot ofdevelopers' minds, tied to
shortcuts. And shortcuts is verymuch a pro user feature.

Peter (08:51):
Mhmm.

Geoff (08:52):
But it turns out that while App Intense being designed
for shortcuts is kind of a wayto think about it, the actions
can actually be exposed in waysthat are way more obvious and
way more presented to the user.And it makes sense to focus on

(09:13):
building app intents becausethose other more exposed ones
are there. And so for that, thatis stuff like app intents. That
is stuff like the new customcontrols in iOS 18. That is
stuff like focus filters.
That one's kind of more of apower user feature.

Peter (09:30):
Or live widgets?

Geoff (09:31):
The shortcut the the the spot sorry, the spotlight
actions, the live widgets. Yeah.All of these things. And so
while you as a developerprobably want to think about it
in terms of what it could be asa single item in, shortcuts,
because that is the right mentalmodel for designing these atomic

(09:52):
actions. It turns out that eachof these actions is more usable
by the users in ways outside ofshortcuts.

Peter (10:03):
I think maybe the definition here of, like, a
really good use of an app intentis when the the user doesn't
realize they're using 1. Right?Mhmm. You know, meaning that,
yes, you know, I asked Sirisomething, and Siri, for once,
actually accurately repliesbecause I've got an app intent

(10:24):
that it that Siri recognizes.Right?

Geoff (10:27):
Well, that is yeah. As we're recording today, Apple
released the release candidatefor iOS 18 dot 1, which is the
one that's really gonna start tobe able to take advantage of
some of the Apple Intelligenceapp intents and that that work
that is being done there. Butfor years now, 2 or 3 at least,
you've had the ability to exposeyour app intents to spotlight.

(10:50):
So when the user is searchingfor something in their app, you
might, have some kind of actionthat your app can take appear in
the search list even if the userdidn't look for that app in
particular. And so that's kindof what I'm getting at with this
idea of, like, design forshortcuts because that's the
right mental model, but then usethat to kind of get a foothold

(11:15):
in these other areas that usersare more likely to run across.

Peter (11:18):
Mhmm.

Geoff (11:19):
For example, in my app Bark, I've got a intent that
just shows you a given bar code.

Peter (11:29):
Mhmm.

Geoff (11:29):
Type in the name of the bar code, and it passes that bar
code to you. Now, I'm not takingmy own advice yet. This is
because I had a tight deadlineon releasing bark. But Yeah. So
I have this shortcut action inthere, but what would make sense
is what if I have that exposedas a spotlight action as well?
And all I have to do is reallyjust kinda take that existing

(11:52):
app intent and make it aspotlight action, and suddenly
you can now search for yourbarcodes in spotlight, Never
launch my app. Never have to seemy app. Just go into spotlight,
search for your barcode name,tap it, boom, there's an image
of your barcode. That issomething that I think would be
really useful to users in a waythat, okay, well, you can bring

(12:15):
up a barcode as part of ashortcut, maybe is not as useful
to the vast majority of users.

Peter (12:21):
That is a good example right there. Because let's say,
for example, I've got, you know,the barcode for some concert
ticket. Right? You know, yes, Icould go into the app and get it
and, but I've got a couple ofoptions via the the intent here.
You're enabling me to either,you know, I can put it as a

(12:43):
widget on my home screen.
I get to the thing. I just gonnatap it. Boom. There you go. Or,
you know, if I wanna risktalking to Siri in public, I
don't know why anybody wouldwanna do that, but you can ask
Siri and those kind of things.
But the idea being that theintent is gonna get me right
down to that one specific thingthat I want from the

(13:06):
application. Much like I mean,this is perhaps a bad example,
but the weather widget. Right?My location. Well, you know,
it's probably I don't know.
But in the background, maybesending in my ZIP code or my GPS
coordinates, pulling that backout via, you know, an app intent
and and getting the weather.That kind of thing is what we're

(13:26):
talking about. Right?

Geoff (13:28):
Yep. So, yeah, like like I said, the most well known
thing that app intents are usedfor, well, at least until 18 dot
1 and Apple Intelligence, isshortcuts. But I think I've got
a a partial list of a lot of theother things that it can be used
for. And maybe I know you'vealso done your own independent

(13:48):
research. Maybe you have somethat I've missed.
But Alright. The ones that Iknow of are being able to
configure a widget. So when youlong press a widget and you have
the background, you can, like,change some things about the
widgets. So, like, with theweather one, it might be what
city are you looking at.

Peter (14:04):
Yep.

Geoff (14:04):
That's all handled by App Intense. For the interactive
widgets that we got last year or2 years ago, I don't remember,
that's all handled by appintents where when you tap on
something in a widget and ittakes an action, that's an app
intent. You have the new customcontrol center items that we got
this year.

Peter (14:23):
Mhmm.

Geoff (14:23):
When you tap on those, those do something based on an
app intent. It's keeping alongthe same line. You also have
interactive live activities.When you've got a live activity
on your screen, you wanted to dosomething. That's all app
intents.
We have the one that we've beendiscussing for a while now, the
spotlight actions. Yep. That isthe ability to see something

(14:44):
that is an action, or in somecases, just an actual item in
your app. That is a app intent.Focus filters, so when you have
the something in your app thatchanges depending on a user's
currently selected focus,whether it's, like, their
bedtime focus, or their drivingfocus, or work or personal or

(15:06):
whatever.

Peter (15:07):
That's a good one.

Geoff (15:07):
I think so. Preferences to users is all, an app intent.
It's very similar to theconfiguring a widget app intent.
And then the ability to interactwith some of Apple's hardware
stuff, we mentioned thisearlier. This is mostly just
running shortcuts, but you canobviously Mhmm.

(15:28):
Have just a single actionshortcut that is with the action
button. And one that I think alot of people miss is the
squeeze function on the ApplePencil Pro.

Peter (15:38):
Oh, good point. Yeah.

Geoff (15:39):
Directly to a shortcut and have it do different things.
So that's my list of of thingsthat app intents can do that are
not shortcuts. So

Peter (15:48):
No. That's no. You've got it.

Geoff (15:49):
Did I miss anything?

Peter (15:51):
No. You've got it. You've got a couple on there that I
missed. Yeah. And and and now Iactually wanna call this episode
intent to squeeze.
Just see where that takes us,You know?

Geoff (16:01):
That's that's that's

Peter (16:03):
No. Actually, I've completely forgot about the
pencil one. That

Geoff (16:07):
that Yeah. I I think a lot of people did. Yeah.

Peter (16:10):
That's cool. Yeah. Did you use that one when you

Geoff (16:14):
I have not. No. No. The black highlighter Apple Pencil
integration is entirely just,handling the Apple Pencil
squeeze interaction directly.It's not using Apple Pencil.

Peter (16:24):
Okay. Now clear something up for me here because in my
mind, I'm thinking that an appintent is really also a
replacement for, you know, somethings like,
well, indirectly deep links. Right? Not to imply that
it is, but
it's kind of like a

Geoff (16:47):
yeah. I yeah, I wanna link to an article, a great
article by developer, VidditBhargava. He makes, look up a
dictionary app and word of theday, which is also kind of a
dictionary app, but it's moredirected at, hey, learning new
vocabulary. And he has a articlecalled Action Centered Design

(17:09):
that isn't really about appintents, but it is kind of about
app intents, which is sayingthat rather than designing your
app as a set of UI, ratherdesign your app as a set of
actions that a user could take,and then build the UI over those
actions. What does the userinterface for performing this

(17:32):
thing look like?
And once you have that set ofactions, it's a set of, like,
nouns and verbs. And once youhave that set of actions, those
map very neatly to app intents.And so all of the nouns and
verbs that your app can do or oruse build an app intent for
those.

Peter (17:52):
Alright. Here it is. The one thing that I cannot do
without every day, and that ismy coffee. Anyone that knows me
or anyone that's listened to anyof my podcasts or anything else
knows that I absolutely cannotoperate without my coffee and I
love good coffee. So here's thedeal.
I'm gonna give you one free bagof coffee by going to

(18:13):
peterwidham.com forward slashcoffee. There is a wonderful
company out there that followsthe fair trade practices, helps
out a lot of independentroasters of all sizes, and the
operation is simple. What you dois you're gonna go to to
peterwidham.com forward slashcoffee. You sign up there. You

(18:33):
get a free bag of coffee sent toyou.
Yes, in return. They say thankyou to me by giving me some
coffee, but that's not thereason I'm doing this. The
reason I'm doing this is becauseI have found so many good
coffees that I just would neverhave come across, heard about or
experienced without thisservice. Trade coffee is just

(18:56):
fantastic. You know, there areplenty of places out there.
We all know them that supplycoffee, good coffee. You can go
to the store, get the coffee,but there is nothing better than
discovering new independentroasters and supporting them,
discovering new flavors ofcoffee, new grinds for you can
set it up. It's very smart. Youtell it the kind of coffee you

(19:19):
like and over time it getsbetter and better as it trains
in on your selections and yourchoices and gives you exactly
the coffee you're looking forand recommending new ones that
that will be very similar. Everytime I get a new packet of
coffee, I go through andafterwards I try the coffee, I
go through the service and Isay, look, I loved this coffee.

(19:40):
I thought this coffee was okayor I say, look, I've this was
really not for me. And everytime I do that, it makes the
service a little more accurateon the next selection for me. So
again, just go topeterwhidham.comforward/coffee.
Get your free bag of coffeetoday. If you're a coffee lover,
you're gonna really appreciatethis service.
I have been using it for yearsat this point and thoroughly

(20:03):
recommend it.

Geoff (20:04):
So if I'm thinking about my app Bark, for example, I can
add a new bar code. I can scan apicture and get bar codes out of
it. I can open a bar code in theapp. I can add a location to a
bar code. I can add a time to abar code.
I can export something to AppleWallet. These are all of the

(20:27):
different individual actions myapp might take, and I should
probably have an app intent forevery single one of them. And
then based on that, be able tosay what are the other use cases
for those app intents. And so,for example, adding a location,
that might be something that'sreally only useful in shortcuts,
but show me a bar code. That'suseful in shortcuts.

(20:51):
That's useful in spotlightsearch, that's useful as a live
activity button, that's usefulas a lot of things. And so what
can I once I have all of theseactions listed, like, what are
the various ways that somebodymight want to interact with
them? And I I I think that itmakes a lot of sense to have

(21:11):
something like that, be thebasis for how you design when
you use App Intense.

Peter (21:18):
Okay. Yeah. I I'm gonna go read that article myself
because as I was watching one ofthe Apple developer videos today
to remind myself how all thisstuff works, you know, Apple
very much talks about it in thatcontext, you know, verbs and so
on. And afterwards I'm sittinghere and I was thinking to
myself, okay, my job findertracker app. What app intents
would I want to have?

(21:40):
And I started scribbling down alist and very quickly, like you
said, you realize, oh, some ofthese make sense for widgets.
Some of them make sense foropening up interactions for
potentially other developers,you know, things like the share
sheet and all these kind ofthings as well. And I think what

(22:03):
I realized was it's all too easyto get carried away. Right? You
don't need to offer, like, theessential essentially a visual
API for everything in the app.
You just need to look at themand go, what are the key things
someone would want toessentially do quickly without
necessarily diving into an appfor? Right? And that's how what

(22:26):
I was gonna say, once I startedthinking about that, I found my
list got an awful lot shorter towhat what are the things I
actually would wanna do. Right?And what are the things

Geoff (22:35):
I don't care about? I I think I disagree.

Peter (22:38):
Okay. Cool. In this

Geoff (22:39):
case, and and kinda to to back up with with the other
article there that we linked to,there's also this is an older
WWDC video. I I don't remember.I'll have to go find it and and
what year it was in. K. AppleApple engineer Michael Gorbach,
and I have no idea if Ipronounced that name right.
So sorry, Michael. Talkingabout, like, really honestly,

(23:00):
you really should have everysingle action that your app can
do exposed as an app intent. Andbeing able to effectively allow
users to remix your app makes itso that there is way more of an
ability for users to interactwith your app. And so that was
kinda getting back to what I wastalking about with Bark in the

(23:22):
first place is, like, I shippeda very limited number of
shortcuts for my first versionof Bark, but I do know that in a
future release, I have like 10more that I want to do, because
I want every tiny piece of theapp available in a way that
users can kind of quickly dosomething, whatever individual

(23:44):
thing they might want to do inthe app, they are able to do it
without having to launch theapp. I think I actually I I've
been using Bark as the example,because that's, you know, my new
hot ness, and so, it's what'smost front of mine.
I've got a a user for blackhighlighter who is very excited
about, like, the differentthings that black highlighter
could do Mhmm. And all of theways that I could expose the

(24:08):
functionality of blackhighlighter through app intents.
And being able to quickly say,like, oh, go grab the latest
screenshot I just took and eraseevery single phone number in it,
and then using a certain color,and then save it. And then now
I've taken this image, and nowI'm gonna put it in the rest of

(24:29):
my shortcut, which is, like,post it to Twitter, for example.
And what I have in blackhighlighter in shortcuts,
especially before I startedinteracting with this user, was
a lot more limited.
And they've been sending meideas and just, like, the number
of things that it's kind ofexposed to me, like, oh, yeah.

(24:49):
No. Like, if I get way moregranular and way more thorough
in what black highlighter isdoing, it makes the app way more
powerful in a way that I don'treally have to complicate my
user interface for.

Peter (25:04):
And

Geoff (25:04):
Okay. So it allows for all of these individual actions,
all of these individual thingsthat a lot of them are, in fact,
already in the app, but, youknow, take a bunch of taps or
take a bunch of of, steps to do.And if I expose them as app
intents in a very granularfashion, users are basically
able to build their owninterface for it. And that is a

(25:27):
very powerful way. And, yeah,this is shortcuts.
This is very much a power userfeature. But you can imagine the
same sort of thing happeningwith Spotlight, for example.
Like, oh, I need to do x thingvery quickly. Let me just type
in the action that I would beperforming, and now it's
available. It's done for me, andI don't have to think about it.

(25:49):
And I think that's a very goodway for users to be able to
interact with your app withouthaving to interact with your app
and kind of just have peoplerealizing how important your app
is to them without having to gothrough the hassle of, like, oh,
man. I had to, like, open thisapp, and I've gotta, like, wait
for it to do this thing, and Igotta get to this page, and then

(26:10):
I gotta go do that. Being ableto instead just have every
single thing that your app coulddo more exposed to the system
gives them the benefit of yourapp without you having to build
out special features explicitly.

Peter (26:26):
So it is interesting. I had never thought about it from
the perspective of empowering ana user to remix my app and
essentially chain together appintents to perform some series
of actions and use the app in away that I'd never envisioned
or, you know, the the endresult, something like that. The

(26:49):
reason I thought though that itwas a bad idea to expose too
many things, and and maybe thisis just my experience and I've
been using the wrong apps. Idon't know. Is I hate it when I
go to, like, set up some widgetsand I'll select an app and I'm
just inundated with a 1,000variations of the widget, you

(27:12):
know.
And it's like, look, I know whatI want. I don't want this
endless scrolling list. But nowthat you've said it, I do like
the idea, especially if I freezethe context and say, okay, if I
was a power user and I was usingshortcuts, I can essentially
chain together a whole series ofactions to make Mhmm. An app do
something the the creator neverdreamed of, but has empowered me

(27:35):
to do it. So I'll give you thatone.
Yeah. Alright.

Geoff (27:39):
And I I think that there is something even in that that
kind of is more like what is thepower of app intents versus what
are the power of widgets. Youcan imagine a world in which
you're talking about an issuewhere the user or sorry, where
the developer has provided abunch of different widgets. What
if they provided a smallernumber of widgets that because

(28:01):
of app intents were far morecustomizable? I think that would
have made a better experiencewhere you are using app intents
to take a more limited userinterface and make it more
customizable as opposed tosaying, well, we're gonna think
of the top ten things that auser might want and display 10

(28:23):
different widgets as opposed tohaving a single widget that is
customizable in 30 differentways.

Peter (28:30):
Yeah. Yeah. And in fact, you know, shout out to Cricket
in the chat room here who pointsout, you know, we can spend a
lot of time planning andbuilding these interfaces, but
as things like AI and and thatcome along and you have this
more, hopefully, naturalconversation with your devices

(28:50):
that pretend then take thesethings and perform actions, the
idea of okay. You know, I shouldprovide you a UI, but let's have
this smart AI in the backgrounduse my intents to take what
you're asking me to do and runit for you, essentially with no
UI at that point. Right?

(29:12):
No. But that that's a goodpoint. Yeah.

Geoff (29:14):
In in that same case, you know, kinda like going back to
the widget example or going backto, just just in line with what
Cricket is saying is having allof this in your actual UI means
that you've made your UI morecomplicated for everyone.

Peter (29:30):
Mhmm.

Geoff (29:30):
Whereas giving people building blocks to build their
own UI means that you're able tobuild a much simpler UI for
specifically the thing that youwant to be able to do.

Peter (29:41):
And also just struck me too, you don't have to worry
about the UI across platforms.Right? So I can just as easily
talk to my watch as I can talkto a app on desktop, a phone, a
tablet, and so on. So it's it'sa real valid point there. Okay.
So let's let's now dive intosome code here and and give

(30:03):
folks, a way to get started withthis and some ideas on how to
use it. Of course, we will putlinks in the show notes for
everything. Thoroughly recommendas always go over to the portal,
watch the the videos because,they're very informative and
they're and actually you willget started with this really

(30:23):
quickly. Quite surprised howquickly it happens. Okay.
So I'm gonna give you a a verysimple example here based on the
videos. This is one for my app.All this does is create an app
intent, expose it to the system,and you tap on it, it opens your
app. Right? Yeah.
Okay. No great joy there, butthis is the simplest form of a

(30:46):
of an app intent I could find.So, you know, you can open up a
new Swift file. Right? You'regonna create a struct, give it
some name.
In my case, I called it add job.It's of type app intent. There
are a few different typesdepending on what your goal is,
and and we'll get into some ofthose. But that gives me an
empty struct. In there, I'vejust got a very simple, static

(31:10):
let title with a localizedstring so that you can see it in
the system.
Right? It's essentially a titleis what it is. Right? So you you
know what you're looking at asthe user's gonna use it. And
then I've got a a function toperform.
It's an async throws with someintent result. And in there, all

(31:31):
I do is I'm returning thatresult and it's got one extra
line for some navigation withinmy app. And then, at the end of
it, in the struct, I've just gota static let, open app when run
set to true because I'm notpassing in any configuration and
things like that. So it's likejust run the app. Right?
Now worth noting, if you wasdoing something extra passing in

(31:53):
data or something along thoselines, you wouldn't need to put
that line because, obviously,it's gonna open your app. Right?
But that is all you need to doto get a very basic working app
intent that's exposed to thesystem. What I like about that
is Apple has taken all of thepain out of it. Right?

(32:13):
None of this having to registerin my configuration for my app
to say, you know, hey. Exposethis to the system or here is a
list of the things. You justcreate this struct. That's it.
It's done.
So, that's that's my example ofa very basic struct there. But,
Geoff, you wanna you wanna divein and make it more interesting?

Geoff (32:36):
Time for a break.

Peter (32:38):
Hey, everybody. It's Peter Widom here from the
Compulsory podcast. I wanna tellyou about Setapp. Setapp is a
service that provides asubscription fee of just $10 a
month, and you get access toover 200 Mac applications. And
it's also available now on iOSas part of that deal.
I use the service because itjust has a ton of really good

(33:02):
first rate apps that I use allthe time. And for me, it's
invaluable as a developer tohave access to tools for things
like APIs, for planningprojects, writing emails,
writing documentation, and youget all of these things
including database apps, all ofthat kind of stuff right there
on the setup service for just$10 a month. You can use as many

(33:24):
or as few applications as youneed. If you're interested in
checking this out, go topetawitham.competerwitham.comforward/setappset
app, and you can see the detailsthere. And it's got a link that
you can go over and start usingthe service and see how it works

(33:45):
out for you.
I strongly recommend this toevery Mac user.

Geoff (33:49):
Break time over. So, yeah, the basic app intent, as
you described, is just a swiftstruct with a certain protocol
and a few default parameters.Now what you can do is you can
also add additional propertieswith property wrappers on them
that Apple provides, and thoseallow you to add additional
configuration to your, intent.To go back a little bit, I

(34:15):
talked about adding parameters.Once you add parameters, you can
also add a parameter summary,which is the UI that is exposed
to 2 shortcuts.
It's it's the sentence that yousee in shortcuts. And so, like,
for example, I have my openbarcode 1. What you provide is
actually a string that hasreferences to those parameters

(34:38):
as keypads in the parametersummary. And so that is what
gives you the UI that you see inshortcuts, where you have
English text or whateverlanguage text, and then you have
these little spots in thatsentence. And you can fill those
spots in either by pickingsomething directly or by

(35:01):
referencing the result of anearlier shortcut is that is what
fills that in.
And so that is the parametersummary, this entire sentence
that you have with references toslots that you might put in
there. For example, you have theat parameter property wrapper,
and that allows you to take inadditional parameters from
users. So if you're thinking inshortcuts, for example, you

(35:24):
might wanna pass in the name ofa thing that you're dealing
with, or you might wanna passin, the size of an image that
you wanna export or somethinglike that. And you can take in a
bunch of different values. Theseare your kind of standard
property list values.
You you got your ints, yourstrings, your files, URLs, your
all of those kinds of things.And those are the default system

(35:46):
ones. You can additionallyexpose data from within your app
to the app intense framework aswell, and that's called an app
entity. And these are the nounsin the nouns and verbs I
described earlier. So forexample, in my app, bark,
barcodes are a app entity, and Ineed to expose what are all of
the barcodes that I have in myapp out as app entities.

(36:10):
And that allows me then to say,okay. Well, have an app intent
that gives me a list of all ofmy barcodes. Or if a user wants
to have a parameter that opens aspecific barcode, then shortcuts
can show that list of barcodesto them where they tap open a
given barcode. They can tap onthat little spot where the

(36:31):
barcode is, and it'll give themthe list of barcodes, and then
they can select which one theywanted to open.

Peter (36:36):
Yeah. You can essentially it's like querying the data in
your app. Right?

Geoff (36:39):
Yep. Exactly. You you do it's in fact, what, is required
to do an app intent or sorry, iswhat is required to do an app
entity is defining an app entityquery. That is a type you
implement that allows you toreturn all of the entities that
your app is using. Cricket has aquestion about, can you still

(37:02):
define a model?
Yes, question mark. Can youdefine a model as an app entity
if it's not stored on device?And if you do have an app intent
that lists these, can you have afetch and query? Yes. You can
have, you can have an app entitythat does querying, and I

(37:22):
believe it does also have, say,like, network access so that you
can you can tell it to, like, goand, like, oh, I need to hit my
server and go do that.
What is more complicated, andthis is the part where I don't
get into, like, I don't reallyknow how this works, past a
certain number of entities. Andso you can think of, for
example, like Netflix's cataloghere. If Netflix was building

(37:46):
out a shortcut and they're like,watch movie and you have every
movie that could possibly inNetflix's catalog, that is a
different system that you use tointegrate with those, and I
don't a 100% know how thatworks. And so I think that
that's where you get into thislevel of, like, app entity
queries are meant to be more forlimited sets of items that are

(38:12):
specific to the user. So forexample, a better example here
would be a weather app.
You would include the entitiesthat a user has probably
previously searched for. Youwould not include every city in
the world. That is a differentsystem that you have to go
through, and I don't know muchabout how that system works. And

(38:35):
so Okay. Yeah.
You can do, stuff a little bitmore, async, and I I think you
can call out to a server at thatpart. I haven't done that
specifically. So I'm I'm prettysure there's no, like, sandbox.
You just have a limited amountof time, basically.

Peter (38:53):
That's what I was gonna say.

Geoff (38:54):
But then the the results that you return, you can you can
do whatever you want to there.And it it's a matter of doing,
like, a deep search or somethingthat uses this other system.

Peter (39:06):
Yeah. Because I was and and I think you know, because at
first, I wasn't sure that Iunderstood. But if you're
talking about, can I have can Irun an app intent that makes
some remote API call, waits fora response, comes back,
processes whatever that may be,and then present it to the user

(39:27):
as a selection or whateveryou're gonna do on the return of
that app intent? I was gonnacomment. I I gotta believe
there's probably, first of all,an an acceptable user amount of
time to wait.
And then secondly, there mayeven be, you know, a a
predefined expiry time. Right?And an app intent, I would

(39:49):
imagine, Apple is not gonna letyou run it forever. Right? So if
you're bringing back a lot ofdata or slow server, bad
connection, anything like that,I gotta believe there's gonna be
an automatic cutout in theresomewhere.
But I also

Geoff (40:02):
I think it's on the order of 10 seconds.

Peter (40:04):
Okay. That seems don't know exactly. But, yeah, it's
That seems reasonable.

Geoff (40:07):
It's reasonable enough to go hit a dead server and do
something. It's not enough to,like, do a ton of processing.

Peter (40:12):
Yeah. And and, you know, as a user, would I wait 10
seconds for an app intent to dosomething? I don't know that I
would, because I'm impatient,you know. But but I think if he
was looking at doing somethinglike that, I actually wonder
maybe that's more of a stop andthink about, you know, if that's
a goal in the app, how you'redoing it in the app, maybe.

(40:34):
Right?
Because, yes, I'd be concernedabout that user interaction
level and time.

Geoff (40:39):
Sorry. To to respond to this question, there is a limit.
It's fairly generous. And, yeah,I I have not done it, but I'm
99.9% sure that you can makenetwork calls. And and basically
anything that your app can do,you can do.
It it you can say you can markyour app intent as running in

(41:00):
your app's environment, I guess.And so it's basically launching
your app, and then you can dowhatever your app normally does.
And so it it's not sandboxed ina way that, for example, a lot
of extensions are. Or it's like,oh, you've got a very limited
memory environment, and you'renot able to make network calls,
and you're not able to dowhatever. App entities can
basically do anything an app cando.

Peter (41:21):
I wonder if there's an an yes. Same thing. I've not looked
into this, but I almost hopefrom a security standpoint,
maybe there's a requirement towhitelist what you gonna be
allowed to call from the app sothat, you know, want someone to
try and use it maliciously orsomething like that. Right? I
don't know.

Geoff (41:40):
I mean, I I it's sandboxed like your normal app
is sandboxed. And so

Peter (41:44):
Right. And that's what I mean.

Geoff (41:45):
Not yeah.

Peter (41:46):
Sorry. Not just from the app intent, but your app is in
general. If your app's gonnacall out and you're gonna expose
that, security practicesdefinitely in play Yeah. Just in
case.

Geoff (41:56):
And so I I I think it's the case, like, you know, if
your user has not granted youlocation permissions within your
app. Right. Absolutely. Yeah.And so Yeah.
That is,

Peter (42:05):
like, one of the things that,

Geoff (42:06):
you know, like, Bark

Peter (42:07):
currently

Geoff (42:07):
doesn't have photo permissions at all. All. That is
a feature that will be comingdown in the future. This part's
not in the thing, and just I cantalk about future plans. But one
thing that you can do right nowif you really want to have
access to your photo library isyou can literally just have

(42:30):
shortcuts

Peter (42:30):
reference your photo library. It goes and gets your
photo.

Geoff (42:30):
It passes that as just an bark. And then that is a way for
you to use your photo library inbark, is just by having it, by
having shortcuts handle it,basically. Yeah. And then that
way, I have not I haven't had tobuild out, like, oh, I need to

(42:53):
know I need to have photopermissions access. I haven't
had to build that out.
I can kinda just, like, letshortcuts handle okay. Here's
it's got all of the photopermissions access, and now it's
going and grabbing that photo,and it's just giving me that one
photo to my app intent.

Peter (43:10):
Yeah. It comes back to, like, we were saying earlier.
Right? The beauty of shortcutsand being able to essentially
just chain together usefulitems. Yeah.
Absolutely. Yeah.

Geoff (43:20):
So, yeah, we talked about, app entities. And so,
yeah, the the way an app entityis defined or sorry. The way an
entity query is defined is itsays you can look up entities by
a given identifier, and so thenyou return any entities that
match an identifier. And thenyou also have the ability to say
suggested entities, which islike a small limited set of the

(43:44):
entities that you think are mostrelevant to the user right now.
And so that's that's thedifference between the entity
query system and this othersystem that I'm talking about
that, is related toCoreSpotlight.
I don't yeah. That's the partthat I I really don't know the
answer to on that one is is how,you do the, like, far more
in-depth exposing of of a bunchof data. But the entity queries

(44:09):
have yeah. You can look upsomething by a specific
identifier, and you can give aset of suggested ones, but you
can't really do, you know, like,deep search type stuff.

Peter (44:23):
Right.
And and that's, you know, sort of alluding back to what I
was saying earlier about, youknow, overdoing this. The the
thing to to remember here isjust like, you know, when you're
creating an API or somethinglike that, you know, the the the
more of these you create, theymay well be useful, but it's
also the more that you have tomanage and hope that they don't

(44:47):
break in a future system. And ifthey do, guess what? You gotta
go fix them all. Right?
Yeah. But, again, I think that'swhy it's one of those, you know,
hopefully, like everything atthis point, folks think about
these ahead of time and plan itout a bit. Right? Don't just put
them in there because, oh, Ishould put that in there. You
know, what's the reason for it?

(45:07):
Right? You know, things likethat. Okay. So that's kind of a
a level one of app intents rightthere. And that probably
satisfies a lot of use cases fora lot of developers out there
and what they wanna do andexposing their apps.
But there's a whole other levelthat we can dive into here where
you can customize them to beexactly, you know, meet the

(45:30):
requirements that you want andwork in the the way that you
feel is appropriate for yourapp. So let's go ahead. You've
definitely got more experiencewith that side of things than I
do. So you wanna go ahead anddive in there?

Geoff (45:43):
Yeah. So once you have your basic app intent, you can
adopt other protocols forspecific use cases for your
intents. And so we talked aboutthe the various use cases for
AppIntense here. We can dig intoone of them. So adding
customizability to a widget.

(46:03):
You take your existing AppIntendwidget exactly as we talked
about defining it, And you cannow add a new protocol called
widget configuration intent. Andwhat that does is it kind of
just takes all of theparameters, parameter summaries,
the titles, everything thatyou've defined, and you just

(46:23):
say, this could also be used toconfigure a widget. And so all
of those parameters that you'veprovided, they now show up in a
widget when you, tap on thelittle thing and you go to,
like, customize, and then itshows your widget's name, that
all of those parameters thatyou've already identified as
your regular app entity, thoseare now in this widget

(46:45):
configuration simply by adoptingthe widget configuration intent
protocol, handling anyadditional requirements it has.
And I think for widgetconfiguration intent, there
isn't anything additional. I'mlooking at the docs right now,
and I don't see anything.
So, yeah, you have your basicapp intent. You say it's now
also a widget configurationintent, and then you assign that

(47:05):
to your widget when you defineyour widget. You can say, like,
oh, configured by blah blahblah, and then you pass in your
app intent there. So you couldhave an app intent that is doing
something in shortcuts and say,by the way, this is also a
widget, configuration intent.And then suddenly you've got the
same code kinda handling 2different cases.

Peter (47:24):
The one that I saw in the Apple video that they gave a
quick example of, I think,brought it home real quickly,
which was, you know, andinterestingly because they they
make mention of it. At first,you didn't see it. It's like,
oh, you got to hit the littledisclosure triangle. Right? And
then it drops down
Mhmm.
In your in the shortcuts, for example, you know,

(47:44):
essentially your options. Andyou can click on it and this
one, for example, was aessentially a drop down list you
could pick from. Right? But theconfiguration side, correct me
if I'm wrong, everything has tobe like most of this stuff,
excluding external data that webriefly spoke about, has to be

(48:05):
configured in the app when youwhen you ship it. Right?
Because the system's gotta beable to read through and
essentially know what your appis wanting to expose so that
when you install the app, itconfigures all of that in the
system. Right?

Geoff (48:19):
Yeah. I mean, that's that's what the app entity
queries that we were discussingearlier

Peter (48:23):
Okay.

Geoff (48:24):
Is is that you are telling the the app, hey, here's
how my data is exposed to thesystem, and here's what might go
in here. And so, for example,you can have one of your
parameters in your widgetconfiguration intent be your app
entity. And you say, like, Ineed you to take in this type of

(48:44):
item, and the user needs toselect an element in this list.

Peter (48:49):
Mhmm.

Geoff (48:49):
And then they you could have that be part of your
widget, for example. So again,we go back to the idea of a
weather widget. You can say thatyour app entity is city, and in
your widget configurationintent, it would have that app
parameter, property wrapper, andthen you could have, for
example, example, var city,colon, city. And city is all

(49:14):
defined by this this app intentquery, yada yada yada. And then
when you get to your widget andyou tap on it and you go to the
edit, on the backside, you have,like, a city, row, and then you
tap on that, and it populatesout a menu, and you can pick
your city from that menu.

(49:35):
That would be how this wouldwork. And so you can imagine
that exact same entity beingused in shortcuts where you have
a sentence there that is like,show me the weather for city,
and then you tap that city. Itpicks the item there. And then
what that does is it returnssome text, for example. Mhmm.

Peter (49:57):
Yeah. That that I think was an example that they put.
Not not for the weatherspecifically, but sort of, you
know, in the videos, they had anexample of how how you would put
it in there like that. And Ithink the the great thing about
that is once you see it, you seethem do it in the video and they
show you the code, you get itreally quickly. It's like, oh,
this, you know, like I wassaying earlier, you know,

(50:21):
originally I struggled with deeplinks and things like that, but
the way that they get thisacross in the video, it just
makes sense and infinitely lesscode to deal with and
configuration, unless you choose
to make it complicated. I mean, by all and configuration,
unless you choose to make itcomplicated. I mean, by all
means. Right? Over engineered ifyou want to, but not
recommended.
Yeah.

Geoff (50:40):
Design of App Intense kind of does lead it to not
getting over complicated becauseyou want it to be kind of these
very minimal, very selfcontained pieces of action. And
so you you want your appentities to really just kind of
do one thing very quickly, getin, get out. That's it. If you

(51:03):
want it to get more complicated,then what you're doing is you're
chaining multiple intentstogether. And you can even do
that in app intents directly.
App intents can call out 2 otherapp intents, or you can leave it
to the user, and they'reresponsible for chaining them
together in something likeshortcuts.

Peter (51:19):
Yeah. I mean, my recommendation is, you know,
like you mentioned at the verybeginning, maybe provide the
blocks to do that, but
Mhmm.
Save yourself the headache. Give give the user the
ability to do what they want.Don't you know, number 1, you
don't have to try and progressit unless there's a very
specific feature in your appthat would benefit from, oh, if

(51:41):
I set these things up for theuser, you know, a bunch of
configuration and stuff as well,fine. Go for it. Right?
But, again, it's all maintenancefor you down the road should you
wanna change something or Applemakes you change it.

Geoff (51:54):
So for example, let me describe some of the app intents
that I have in blackhighlighter. I have one app
intent that is, okay. Give me animage. Give me some words to
redact, and I'll spit you out animage. And another intent that I
have is literally just open animage in black highlighter.

(52:16):
Just give me an image. Go launchthe app with that that image in
there. Now something that a usercan do is they can actually just
chain those 2 images togetherand say, like, I wanna open this
image in black highlighter, butI have a default set of things
that I want always redacted. SoI'm gonna go ahead and have it
do the default things and thenopen the image. The user can go

(52:37):
and they can build those in, ontheir own.
However, one thing that I can doas the developer to kind of make
this easier is I can actually goprovide a hidden parameter.
Hidden parameter is a littlelittle, bit of a misnumber. It's
just kinda behind the drop down.Oh. And have a checkbox there

(52:57):
that is open when run.
And what I can then do is me asthe developer, I can check this
open when run property. It'sjust a boolean. If that's true,
I can just call my open intentdirectly from my redact intent.
And so I can say, go ahead, grabthis image, do the redactions,

(53:20):
and then launch the app. And thethe way that I've done that
under the hood, I'm just callingthe same open intent that the
user could call directly.
And it's just a way of providingconvenience to them by going
directly from scan, redact,open, as opposed to the user
having to have the scan, redact,open intents, all as 3 separate

(53:45):
items.

Peter (53:45):
Okay. That's interesting because that answers a question
that I I was wondering which is,you know, what I was gonna make
the statement that at somepoint, if an app intent feels
like it's getting overlyinteractive or complicated, that
you should at that point say,okay. Now I should pop open the

(54:08):
app, and you you you shouldreally do this in the app. But
what you're describing there issomething I hadn't thought of,
which is, hey, let me do the bitthat, you know, had the ability
to do the the easy bit. And thenif you wanna do this extra
complicated bit, we'll open theapp and pass this off to it.
Right? So you got the best ofboth worlds.

Geoff (54:29):
Yep. Yeah. And and I think that is the benefit of,
like, really decomposing thesedown to their smallest
individual pieces allows you to,a, build your own intents out of
other intents, but then alsoallow users to use those intents
in ways that mix and match themin whatever way they want to.

Peter (54:49):
Yeah. Yeah. Got it. Yeah. I guess it's, you know, it's
kinda like that writingfunctions.
Right? Write a small functionthat does one thing. Don't don't
make it Yeah.

Geoff (54:58):
Exactly. You

Peter (54:59):
know? Don't do it the way I do it. Yeah. Alright, folks.
So I feel like we've covered appintents here.
Certainly enough to get youstarted and interested. And you
should definitely be interestedbecause this, you know, with
with the AI from Apple and, youknow, hopefully, the
improvements in that lady oneday, it's gonna be a thing going

(55:21):
forward. Right? App intense. Soyou the sooner you get on board
and at least becomeknowledgeable, the better.
With that said, Geoff, where canthey find you? Where can they
find your apps with all of theseworking app intents?

Geoff (55:36):
As always, everything is at, cocoatype.com.

Peter (55:39):
There you go. And as always, I'm at compile
swift.com. That's it, folks. Seeyou in the next episode.
Advertise With Us

Popular Podcasts

Stuff You Should Know
My Favorite Murder with Karen Kilgariff and Georgia Hardstark

My Favorite Murder with Karen Kilgariff and Georgia Hardstark

My Favorite Murder is a true crime comedy podcast hosted by Karen Kilgariff and Georgia Hardstark. Each week, Karen and Georgia share compelling true crimes and hometown stories from friends and listeners. Since MFM launched in January of 2016, Karen and Georgia have shared their lifelong interest in true crime and have covered stories of infamous serial killers like the Night Stalker, mysterious cold cases, captivating cults, incredible survivor stories and important events from history like the Tulsa race massacre of 1921. My Favorite Murder is part of the Exactly Right podcast network that provides a platform for bold, creative voices to bring to life provocative, entertaining and relatable stories for audiences everywhere. The Exactly Right roster of podcasts covers a variety of topics including historic true crime, comedic interviews and news, science, pop culture and more. Podcasts on the network include Buried Bones with Kate Winkler Dawson and Paul Holes, That's Messed Up: An SVU Podcast, This Podcast Will Kill You, Bananas and more.

The Joe Rogan Experience

The Joe Rogan Experience

The official podcast of comedian Joe Rogan.

Music, radio and podcasts, all free. Listen online or download the iHeart App.

Connect

© 2025 iHeartMedia, Inc.