All Episodes

September 10, 2024 45 mins

Daniel Steinberg comes in the podcast to talk about his latest book on Swift Testing as well as the state of Swift development in 2024.

Guest

Announcements

Links

Related Episodes

Social Media

Email
leo@brightdigit.com
GitHub - @brightdigit

Twitter
BrightDigit - @brightdigit

Leo - @leogdion

LinkedIn
BrightDigit

Leo

Patreon - brightdigit

Credits

Music from https://filmmusic.io
"Blippy Trance" by Kevin MacLeod (https://incompetech.com)
.css-j9qmi7{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;font-weight:700;margin-bottom:1rem;margin-top:2.8rem;width:100%;-webkit-box-pack:start;-ms-flex-pack:start;-webkit-justify-content:start;justify-content:start;padding-left:5rem;}@media only screen and (max-width: 599px){.css-j9qmi7{padding-left:0;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;}}.css-j9qmi7 svg{fill:#27292D;}.css-j9qmi7 .eagfbvw0{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:#27292D;}

Mark as Played
Transcript

Episode Transcript

Available transcripts are automatically generated. Complete accuracy is not guaranteed.
Leo Dion (host) (00:00):
Hey folks.
I'm trying to get theseepisodes out as soon as I can.
Here's another great episode Idid recently with Daniel on his
new book, the Case of The CrimsonTest Suite and Swift Testing.
Hope you enjoy it.
I'm really excited about going to.
Server site Swift atthe end of September.

(00:20):
Daniel will be there too.
He's given a great talk on macros.
I if you're gonna be in the area,I highly recommend checking it out.
There's a discount codeEMPOWERAPPS, all caps, one word.
If you put that in, you'll get 15% off.
So definitely check that out.
I'll put that in the show notes as well.
Thank you and I hopeyou enjoy this episode.

(00:41):
Bye everybody.
Welcome to anotherepisode of Empower Apps.
I'm your host, Leo Dion.
Today I'm joined with Daniel Steinberg.
Daniel, thank you so much for coming on.

Daniel Steinberg (guest) (00:54):
My pleasure.

Leo Dion (host) (00:55):
This is second time you've been on the podcast and

Daniel Steinberg (guest) (00:58):
time.
I think we talked about functional

Leo Dion (host) (01:01):
we did.
We did.
Yeah.
Well, before we jump in, I'll let you go
ahead and introduce yourself.

Daniel Steinberg (guest) (01:09):
Okay.
I know a lot of you, I see alot of you, at conferences.
I tend to write books anddo contract coding and
teaching both atconferences and privately
on iOS and Mac OS topics.

Leo Dion (host) (01:22):
Speaking of functional programming, where
do you think that is right now?
In a somewhat post combined world?

Daniel Steinberg (guest): That's a good question. (01:30):
undefined
In some ways we're seeingmore of it in Apple APIs.
You're seeing maps andfilters and things all over
the place.
You still see them in,for instance, async
sequences.
So you still see a lot of the things wedid in combine have surfaced in other
places.
So.
I think we came to terms with thefact that as we knew Swift wasn't

(01:53):
really a functional language, butwe could do functional things with
it, and I still like to code that
way a lot.

Leo Dion (host) (01:58):
Yeah, same here.
Yeah, that's a good point.
I feel like if anything, we stillhave, I mean, combine's still around
obviously, but if there's anythingwe still have from That is a lot of
you can see traces of it and the way.
Functional programming is everywherewith anything new that comes out,
including the async sequence stuff.
so yeah, that's

Daniel Steinberg (guest): of the problems (02:17):
undefined
though, is that, you know, functionalprogramming works best with
value types, and we've got that emphasisto use value types and value tips
work best with async and all that.
Yet,
Swift UI is pushing us to use morereference types on the backend
for observable and for SwiftData and things like that.

(02:38):
So it's a bit of a mixed messagebetween Swift and Swift UI.
And so with Swift, it'sa, it's easy to use.
Functional with
Swift UI, it's a little harder.

Leo Dion (host) (02:48):
Yeah.
Yeah, that's true.
That's a really good point.
Yeah, and on top of it we havelike, non copyable types, which is
a whole other like, Pandora's box.

Daniel Steinberg (guest): Understand them yet, so. (02:58):
undefined

Leo Dion (host) (03:03):
that makes two of us.
Okay, so today we're gonna talkabout Swift testing kinda I guess
give the overview of Swift testing,what it offers, alternative to XC
testing, and what have you liked, whathave you disliked about it I guess.

Daniel Steinberg (guest) (03:20):
That's a lot.
So the first thing iswhat attracted me to it.
Every once in a whilesomething gets released
and it just feels likesomething I want to get involved
in.
I wanna write a book about,I want to understand it
better.
And Swift testing.
Not only did I like the
APIs, but the way the
team has.

(03:41):
Work through the process,the support they've given
the community through docs.
It's just been
really,
I
think a model
project from Apple.
And so it's been nice to see

Leo Dion (host) (03:52):
What I think, and I'm gonna, I'm gonna just say
I'm ignorant, but what does SW.

Daniel Steinberg (guest) (03:57):
even after I've written a book.
I.

Leo Dion (host) (04:01):
I went into the videos and I'm like, okay, what
is this offer that XC testing has?
And I do the fact that it's pureSwift for a hundred reasons, but
I'm not sure it offers,what is it offer that XC
testing doesn't already offeroutside of the fact that
it's not tied to Objective-C.

Daniel Steinberg (guest) (04:20):
So I don't know if you remember
when Steve Jobs came back
to Apple.
When Steve Jobs came back
to Apple, there were all sorts of
devices that Apple was sellingall sorts of Macs, and Steve said,
no, we're gonna simplify the line.
We have pro, we haveconsumer, we have laptop, we
have desktop.

(04:41):
And in my view, that's one of thebiggest things that Swift testing
brings is it says, we're gonna simplify.
There's not a thousand XCT asserts.
You
have to know.
You set things up and thenyou either expect a result.
You require
a
result.
And then, so that's the one axis.
And then the other axis is if youexpect it to succeed, that's great.

(05:05):
If you expect it to throw anerror, there's an expect throws or
require throws.
And so the expectations to beginwith are so much easier to work with.

Leo Dion (host) (05:14):
Well, let's talk about that a little bit.
What do you when you say expectations,are we talking about from what.
I remember with XC test is likeyou basically have the ability
to wait for an expectation.
If you have something that getscalled an closure, for instance,
is that what we're talkingabout when we say expectations?

Daniel Steinberg (guest) (05:30):
No, the ex expectation that I'm talking
about is the equivalent of the
XCT assert true XCT assertequal XCT, all of those.
And so instead of that, we have
a pound expect.
The pound expect accepts aBoolean where you say, this thing
equals this thing.
And so,

(05:50):
Everything in Swift testing is amacro, the at test that decorates the
method or the function is a macro.
And the pound expect is also a macro.
The
attest is an attached macro, excuse me.
That decorates the method thatit modifies that it's attached
to, and the pound expect isone of those freestanding

(06:11):
macros that expands intoall the things that we need.
So there's a lot less ceremony,which is kind of nice.

Leo Dion (host) (06:18):
Yeah, that you could definitely say that.
What.
What, if somebody wants to jumpinto it, what's the first thing
that they may be overwhelmed by?
Or that they may feel intimidatedby, that you think helped
you get into Swift testing?

Daniel Steinberg (guest): Well, actually what (06:34):
undefined
made it harder for me and forthose of us that looked at
it right away was it wasn'tintegrated in X code and we had to
do things to make it work.
All that is gone with Xcode
16.
What made it hard from the commandline with Swift packages was we had
to add a flag to Swift test to make it

(06:55):
work That's gone with Xcode
16 beta five.

Leo Dion (host) (06:59):
Okay.

Daniel Steinberg (guest) (07:00):
a lot of the things that made it hard to get
Your feet wet with are gone,and that's really nice.
As for writing your own tests,
it depends on if you're coming from
XC test or not.
If you're coming from XC test.
Then you're used to creating someclass that subclasses from something,
and then you have to write thename of the methods a specific

(07:22):
way and things execute a specific
way.
And so one of the thingsthat might surprise you is
your first test canjust be a free function.
It doesn't have to be part of a
structure class or anything.

Leo Dion (host) (07:35):
Do you think that do you think it's gonna be easier
to like, organize tests and makethem a little bit more readable?
In Swift testing.
That's the biggest benefit I've seen.

Daniel Steinberg (guest) (07:45):
Well, so the Swift testing team has given
us several axes to do that with.
So if you have a
test, you can name it anything you want.
I tend to prefer T names.
Then if you want to see a moredescriptive name, when you run the
test, you have the freedomto create a display name.
So in the AT test, one of the argumentsis how do you want this to appear?

(08:08):
And that's a display name is a string.
And then you say, well, I'vegot this test here and this
test here, and this test
here that I want to group somehow.
Do they have a common reason forbeing I can create a tag and now
I can run all the things with a
common tag?
Do all these
things belong together conceptually and
hierarchically, and I want touse the same setup for them.

(08:30):
I create a
struct, which is a
suite, and I can name that suite
and I can providedifferent things there.
And so there's all these ways oforganizing your tests that are very
handy.

Leo Dion (host) (08:43):
How about, sorry, I'm trying to remember.
How do you keep your tests organized?
Are you doing like your justfunctions out in the main.
File or are you setting upSTRs or what do you suggest?
If you wanna keep your testorganized in a fashion and using
your display name properly and stuff.

Daniel Steinberg (guest): So I use a mix. (09:03):
undefined
Some tests can run on their own.
Some
want to be organized into a suite.
I almost always will use
tags.
You can use which wedidn't talk about yet.
Suites within a suite.
So one of the nice things is soI, if I'm building a calculator
as I do in one of my running

(09:23):
examples and I have all these thingsthat are testing the stack, but inside
of there are ones that testthe stack and they also
test the display.
I might create a strt within a structthat does those, and now I can run
those separately or altogether.
The problems with Swift testing aregenerally not with Swift testing.

(09:43):
They're limitations of
Swift.
So, for example, if I
have a property in my outerstruct and I want to view it
from my inner struct, you can't.
And because we don't create thesetup code, I can't even pass it in.
And so you do have to duplicatesome of the setup if you're
doing a struct within a struct.

Leo Dion (host) (10:03):
Okay.
Got it.
What are some other benefits that yousaw with Swift testing over XC test?

Daniel Steinberg (guest) (10:11):
So one of the things is out of
the box tests automatically runin parallel in random order.
And so you don't
get these
issues where, oh, I didn't,expose that issue because my
tests always run in thisorder, and maybe I've
got some dependenciesthat I don't remember.

(10:31):
On the
other hand, there are some tests thatyou might wanna run in a specific
order, and there's an easy flag, theycall them traits that you can set that
says, run these as serializable.
And so
that's a nice handything that you can do.
Serializable.
Ones
one runs then the next, and
so that
might increase your time.
You're not getting the parallel.

(10:53):
The other thing is they play nice with
asic.
So I can have async
tests and to your questionfrom before, like I
can do an XC test, but so much easier.
I
can require that a testcompletes in some amount of
time.

Leo Dion (host) (11:09):
Oh wow.
Okay.

Daniel Steinberg (guest) (11:11):
I don't wanna wait forever for
this, but I can runsomething that is actually
async.

Leo Dion (host) (11:16):
That's awesome.
Like the things, like I get frustratedwith XY tests is, like you said,
it's a lot of boiler plate code.
Is there even like an ideaof like setup and tear down?
In Swift testing.
Really, do you even need

Daniel Steinberg (guest): You can, but what happens? (11:30):
undefined
For example, if I have a suite thatcontains four tests, what happens is.
A separate instance of that suite ofthat struct is created for each of
those tests and they are run separately.
So you're not getting thecross-contamination there.
I don't have to worry about thesetup and the tear down there.

(11:52):
So maybe I have just an a knit formy struct if I need to set up fancy
things, but for the most part, I'mjust adding a property and giving it a
value, and that's all the setup I need.

Leo Dion (host) (12:05):
What so one of the things, you know, we had a
question or comment in Twitterfrom someone behavior tree said.
It needs in-source testing bettersnapshot serialization, where
you can omit fields, contentfor dates, IDs, et cetera.
One thing, yeah.
That I've heard a lot of is justwell that was one of the things

(12:26):
I was expecting is like theability to do mocking, things like
that, that are difficult to do
in SW Swift basically because
we don't have the dynamic abilitiesthat we got in Objective-C.
And I was looking forward tomaybe some macros for that.
Where do you see that
stance for things that people want?
Do you think there's gonna be

(12:47):
kind of a
community around that, ordo you think it's just not
something that's necessary as much as
people say it's.

Daniel Steinberg (guest) (12:56):
I think both sides of that I think in general when
something doesn't do something you want,
you can both
question that it doesn't do it,and you can question whether
you really want and need it.
Are you doing somethingthat, that you need to do?
There are some things that Swift testing
doesn't do yet, for example.
it explicitly does notdo performance testing.

(13:17):
It explicitly does not do UI testing,
and so these are thingsthat are excluded.
The other thing is this isa first release, and as a
first release, I find it very robust.
In fact, it isn't even released yet.
In a way
it's, you know, in September whenSwiss six comes out that we'll see,
oh, now it's released.

(13:38):
So.
There's a side of me that when
people complain, I justwanna say, come on people.

Leo Dion (host) (13:45):
What if you were that was one thing.
I wanted to mention is that itis, it does require Swift six.
Correct.
And it's delivered as a Swiftpackage, which is really great.
It's like basically it's all opensource, I would assume, right.
So you

Daniel Steinberg (guest) (13:58):
It is open source and you can
submit issues there.
It's an apples.
It's an apple's repl repo on GitHub.
The team is amazingly
responsive.
If you publish on socialor you participate in the
forums.
the team members havebeen just amazingly
responsive and

(14:19):
helpful.

Leo Dion (host) (14:21):
Are they keeping it under the Apple organization
or are they gonna move it to Swiftby any Swift Lang by any chance?

Daniel Steinberg (guest): I think it's on, or I (14:27):
undefined

Leo Dion (host) (14:29):
It is Swift Link.
It is Swift

Daniel Steinberg (guest) (14:31):
not there yet, they announced that it was going
to
be.

Leo Dion (host) (14:33):
Yeah.
No, it is right now as ofthe recording, so yeah.
Yeah.
That's awesome.
Definitely check that out.
Really great documentation here.
One other thing.
So do you think what otherthings do you think are missing
that you think the communitycould use in Swift testing that.
Either you could use additional oryou feel missing from XXI testing.

Daniel Steinberg (guest) (14:55):
What I've, what I found a lot of with my early
experiments with Swift testing isif something isn't behaving, it's
often something the team knows too.
So I'll give you a fun example.
I'm writing the book
and I have this examplewhere I'm serializing.
The whole reason I'm serializing isjust to demo this thing that they have.

(15:17):
Generally, you don't wannaserialize your tests.
You want 'em to run in random order,

Leo Dion (host) (15:21):
Right.

Daniel Steinberg (guest): and they're failing. (15:22):
undefined
They're not running in random order,but they're not running in the order
I expect.
And so they're running firstand third, and all of a sudden,
I realize they're running inalphabetical order of the method name.
But it turns out theteam already knows that.
They fixed it and in thenext release there it was,

(15:43):
in fact, they'd known itbefore I'd encountered it.
It just hadn't made its waythrough the release cycle.
So sometimes these things that we run
into, it's not a limitation of theframework, it's that sometimes things
aren't correctly implemented yet thethings they've thought about are deep.
Now there are some
lacking and there's goodreasons for the lacking.

(16:06):
So I don't know, have youworked with Swift macros at all?

Leo Dion (host) (16:08):
Yes, I've written one Swift macro.

Daniel Steinberg (guest) (16:11):
So one of the nice things about Swift macros
is you can create tests for them andthey have a really nice test template
for XC tests where you can say,here's what I typed in, here's what I
expected to expand to, andeven if something fails,
here's how I expect it to fail.
There's an issue with, Swifttesting with that because

(16:35):
you can't get a cyclicdependency to have things work
out so you can make itwork with Swift testing.
I am, excuse me,
I am updating the macrosbook to accommodate that, but
It's, we're all encountering thistogether and so I don't know if you
remember the early days of Swift UI.

(16:57):
But part of it was a lot of engineersinternal at Apple weren't using this
thing in anger, and so they weren't
realizing what neededto change about it.
And you saw in Swift two and threeas they started using it internally,
they said, oh, you guys wereright about the navigation view.
It needs to be something stronger.
And now we get a navigation stack.

(17:18):
I think the same thing willhappen with Swift testing as
more internal
people use it.

Leo Dion (host) (17:22):
One thing we didn't mention and I think is a huge benefit
of Swift testing is like the datadriven stuff where you can set up.
Series of and say these should equal,these should result into these, you
know, you know what I'm talking about.
I'm not sure the exact

Daniel Steinberg (guest) (17:38):
I think what you mean more is the testing

Leo Dion (host) (17:42):
Yes, that's exactly what I mean.
Thank you, Daniel.

Daniel Steinberg (guest) (17:44):
for.
you know, five tests that essentiallydo the same thing, but each one
takes a different piece of input.
You can say, okay, here'sthese pieces of input.
Put 'em in an array and saythat this test depends on these
arguments, and now it'll run them.
And what it does is very clever.

(18:06):
This single test will createfive instances of the test,
one for each of the inputs.
So if one fails, you can see it.
You can see what went wrong.
You can fix the issue, run the wrongtests first, and then run all the tests
to make sure it's fixed for all of them.
The other thing is, say you havetwo axes and so you want two arrays.

(18:29):
And so if I have two arrays,what it'll do is it'll create
tests for each combination.
And so if I have five in the firstarray and four in the second,
I get 20 tests.
Now, that's the limitation,
unfortunately.
I can't put in a third array.
So the limitation is two arrays, andat least at this point, the warning,

(18:50):
if you put in a third array doesn'tsay that's what you've done wrong.
It's calling out something else.
But if you try two more than two arrays,
but you can get clever and youcan zip two together, or you
can group them differently orhave an array of tuple if you
want.
So there's many ways around it.
I don't find it a deep limitation.

(19:13):
Again if you're wanting todo more than two arrays,
you may need to ask, do I really need
to, or is there another way to look at
it?
And what they're trying toprevent is, it's so easy for us
to feed in so many arrays and nowwe've got an explosion of tests.
And often there's so
much redundancy that whyare you taxing the system

(19:33):
like that?

Leo Dion (host) (19:34):
Yeah.
Yeah, that's a fair point.
If you were gonna start a project,let's say you're gonna do an
app, would you go with Swift
testing or would you go with Ixy test?

Daniel Steinberg (guest) (19:44):
I would go with Swift testing, but I
tend to do almost no UI testing.
My, my UI layer is very thin, andso if I've really tested the model
and what I still call the controllerlayer, you know, the view model,
the presenter, whatever you call
it, if I've really
tested those properly.
Then the connection of the UI to those

(20:06):
I don't really
test that much, but if you've seenmy apps, the designs aren't pretty.
And so I'm not looking at screenshots
to see if,
Things look right.
In fact, I will
say thank goodness for techreviewers In a previous example of my
calculator app, I had no four and five
buttons.
I had two, two and three buttons.

(20:26):
So.

Leo Dion (host) (20:30):
Nice.
And so you would go it require,but it requires Swift six, right?
So if you're, you have touse X code 16 basically, if
you're gonna do Swift testing.
right?

Daniel Steinberg (guest) (20:41):
But if I'm creating a new project,
that's what I'm gonna do.
You said if I'm creating anew app, what would I do?
The other thing is if I'mcreating a new package.
I would absolutely
do it in Swift six.
cause one of the nicethings in Swift six
is you can mix Swiss fiveand Swift six packages.
So if I'm creating a new package,I do it in Swift six, I use

(21:03):
Swift testing and I'm not doingmuch UI in a package anyway,
so
I'm feeling pretty good about that.
And one of the really
nice things Apple did withthis transition to Swift six is
package by package.
They can be Swift five, Swift six,and everything works well together.

Leo Dion (host) (21:19):
Yep.
Yeah.
That's awesome.

Daniel Steinberg (guest) (21:22):
I know I sound like such a fan boy

Leo Dion (host) (21:25):
with Swift six or Swift testing?

Daniel Steinberg (guest): with all of it. (21:27):
undefined

Leo Dion (host) (21:29):
I know, I mean, yeah, so sw, so ga, you would totally
go on board with Swift testing.
As far as moving forward, there'snothing you miss from XC test at all.

Daniel Steinberg (guest) (21:40):
so I was a fan of behavior driven development,
not test driven development.
And that's the given when then
type
of setting.
And so years ago I'd likethe sort of the kiwi, the
cucumber type of testingframeworks, XY test.
Was
kind of like a port

(22:01):
of the old J unit, not even what J Unit
has become.

Leo Dion (host) (22:05):
That's a

Daniel Steinberg (guest): other thing is, yes, (22:05):
undefined

Leo Dion (host) (22:08):
Okay.

Daniel Steinberg (guest) (22:09):
And, so the other thing is that Xcode,
as much as I really like Xcode.
There's
some things that Xcode has neverdone that makes testing much easier.
So for instance, IntelliJ for I think20 years since the old Java days
when they were first gettingstarted, had this thing where

(22:30):
in a test, if you said, I wantto test that this class has this
method and it didn't have thismethod, Intej would say, well, do
you want me to stub it out for you?
There's no reason that Swift,which is strongly typed, and
Xcode can't do that for us now, but itdoesn't, and that makes testing so much
easier if you can, if you really wantto do TDD and drive your development

(22:55):
with tests.
And so I tend to do more testmy things as I create 'em.
I don't drive
it.
But one of the key features of
testing for me is not that I'm
testing the app.
I'm writing
API that consumes
the thing that I'm creating.
And so it's the first code that Iwrite that consumes this new thing

(23:17):
that I, so I can look and go, well,
I don't know, like theway I call that method,
I'm calling it from a test.
But what it means is then I go in
and I change the way I call that method.
I change its name.
I change its parameters.
I make a, an invisible label
so that I'm not having to call a label
colon, whatever.
And so to me, one of the bigbenefits of testing is design.

Leo Dion (host) (23:41):
I agree with that a hundred percent.
Yeah.
because it's inter you're testingthe interface, but it's like the
interface of the code, right?
Like it's not it's like now you get tosee it in actual use and you're like,
yeah, I don't like how that looks.
And yeah, that makes total,I like that analogy a lot.

Daniel Steinberg (guest): One of the things I like (23:58):
undefined
is with packages, you can alsorun it from the command line
and the reports you get in thecommand line are really nice.
So one of the limitations was, I said
before, if you tag something,you can run just the tags.
Currently, you can
only do that in X code.

Leo Dion (host) (24:15):
Oh, really?
You can't do it in command line.

Daniel Steinberg (guest) (24:18):
You can't do it in the command line, but the
team has said, oh, we see a wayforward, and it's something they're
considering for a futurerelease and that'll be
nice.
The other thing from the commandline, and this isn't a Swift
testing limitation, so muchas the way things are built.
If I want to test aproject, not a package,
I have to specify a

(24:38):
lot more things.
I have to tell you whatthe scheme is and I
gotta tell you what the
target is.
And so that's not assimple as just typing
Swift tests.

Leo Dion (host) (24:47):
Yeah.
Right.
Overall, what's been your impressionof what's come out from WW this summer?
You know.
obviously we've talked about Swifttesting, but has there been a lot
of like new APIs or new oss thatyou've been interested in over the
past few months?

Daniel Steinberg (guest): Well, clearly Apple's push (25:05):
undefined
is the move to Swift six and
getting complete with the, Async APIs,and so that's clearly their push.
I think if you read between the leaves,
App intents are gonna be very big.
It's not something I'm playingwith much yet, but it's clear
that what they're offering now istelling us you need to start using

(25:28):
these are gonna be become more
important.
Apple intelligence.
I don't know how much is shipping in the
betas, but I'll tell you
yesterday I went for a walk.
I forgot to turn off that I was
walking and I drove home
and it said that I walked eight miles
In an hour and that was awesome.

Leo Dion (host) (25:47):
Yeah, we've all had those before.
Have, you, used any of the betas

Daniel Steinberg (guest): Intelligence or whatever would (25:51):
undefined
say, Hey, you're going 30 milesan hour, maybe you're not walking
anymore.

Leo Dion (host) (25:58):
Maybe you should, you know.
Apply to the next Olympics, Iguess, with that kinda speed.
Did You have you installed,the bait on anything yet?

Daniel Steinberg (guest) (26:08):
Yes.
cause I'm an idiot.
I've installed the beta on everything.

Leo Dion (host) (26:12):
Okay.

Daniel Steinberg (guest) (26:13):
I made it to Thursday of WW week
before I put it on my phone.
I put it on
my iPad right away.

Leo Dion (host) (26:18):
Okay.
I.

Daniel Steinberg (guest) (26:20):
And so it's been on my carry device.
I have a separatepartition where I'm running
it on my
Mac.

Leo Dion (host) (26:25):
Oh, see, I'm more stupid than you.
'cause I'm running itright now on this Mac.
that I'm recording, I'm running15 one, so, I'm even crazier.
But then of course my iPhoneis still on, what is it?
16?
Yeah.
Six.
No, 17.
Right.
So I, do you have, you,have you done 18 one yet?
Played around with AppleIntelligence on the phone?

Daniel Steinberg (guest) (26:49):
I've not played around with it.
As I said, if it was there.
I mean, it should have told medifferent things, so I have it on
the phone, but if it was there,it should, I'm not convinced.

Leo Dion (host) (27:01):
Yeah, Right, right.

Daniel Steinberg (guest) (27:02):
But, you know, I feel very strongly that for me, AI
is not LLMs is a separate discussionand I'm not really interested in LLMs.
I'm very interested in what Applecan do with AI and ml 'cause.
I look at what photos does with ml, andI think that's a compelling use case.

Leo Dion (host) (27:21):
Yeah, and I think that's a big problem is that AI
has become LLMs essentially inmarketing speak, and Apple has been
ahead with like other forms of ai.
Like you said, photography'sthe big one, right?
Where like they've been doingphotography stuff for years.
And other things that they'vedone with the watch and

(27:42):
various things wherethey've detected things.
The vision.
Pro is a great example of that.
But now it's like the
total focus is ongenerative and LLM and it's
I don't know.
We'll see how far that goes.
I wouldn't say I'm a skeptic, but
there's only so much LLMs,
and generative can do.

Daniel Steinberg (guest) (27:59):
Well, I'm gonna say you're a skeptic.

Leo Dion (host) (28:01):
you're gonna say, I'm a skeptic.
I'm just, I'm not a skeptic.
I think there are
big, there's big benefits,but it's not gonna.
We're have
next year.
So, a little bit like I don'tthink it's the, revolution people
think it is, let's put it that way.
I dunno where you stand on it.

Daniel Steinberg (guest) (28:18):
I think there are things there.
I recently gave a keynote at
Swift, which talked about.
How do you look at all these thingsthat come out at WW and decide
what's for you?
And for me, it's a combinationof things that are interesting.
So Swift testing was interesting,but I also have to find my
place in it.
And so Swift testing,

(28:40):
I find my place in it is, it'ssomething I want to teach.
It's something
I want to explain and it's somethingI want to use in my own code.
Before I wrote the book on
Swift
testing.
I used it in my shipping apps, and
so, you know, the ones that I sent toTestFlight using Swift six have Swift
testing in 'em.
But for A IML, it's interesting,

(29:03):
I don't see where I fit
in there because in orderfor me to do it, I need
access to big clean data sets.
And
that's not something that I, asan indie usually have access to.

Leo Dion (host) (29:13):
Let's I really like that topic.
The, 'cause you talked aboutthat too in Chicago on.
Deep dish where you were, like,you talked a little bit about
it, where you're like, oh, Iwrote a whole book on combine.
And well, your talk was specificallyabout Swift Data, right?
But you talked about combine, youloved combine, you jumped into combine
And then you know, it's been cricketsfor ever since combine came out.

(29:37):
And then now you, they cameout with this new thing, Swift
Data, and it's like, how do you,how like without giving away

Daniel Steinberg (guest) (29:44):
one of the things I said was because
Swift Data had come out last yearand deep Dish was about a month
before Dubb Dub, and what I said
was, I like Swift Data, but beforeI tell you to dig into it, I
would see what Apple does with it.
At this year's WW, ifthere are no sessions.
If there's no
changes to the APIs, then I wouldbe wary and combine was my warning.

(30:09):
That Combine was a beautiful framework.
It was great to use.
I got a lot out of it, but it clearlywas a step, maybe not intentional, but
it was a step along the way to Async.
And once they madethe step towards Async
and even async sequences.
Start something thatare pushed as much as I

(30:29):
would've expected.
Async sequences initially lookedlike a replacement for app
published.
And then we move quickly
to
async.
And so my, my, my only cautionthere was make sure you're
seeing a commitment from
Apple into these thingsbefore you go in.
You know, there was a year,if you're old enough, you
remember there was a year

(30:51):
where we were gonna have garbage
collection on the Mac.
And then we weren't.
So
just sometimes sometimes the
people who aren't able to implementwhat's new because they have support
to back, sometimes they're in agreat position because they get a
couple years to see if something
is gonna

(31:11):
stick or not.
If something's gonnabecome as important as it
looks when you're seeingthat first presentation,
that is so attractive and enticing.

Leo Dion (host) (31:20):
Yeah.
What did you think aboutSwift Data this year?
Because all, I mean, we justgot history stuff, right?
Is that sufficient for you to feellike, oh yeah, Swift Data is the
future, or are you a bit like, eh

Daniel Steinberg (guest): get some of the things I (31:32):
undefined
wanted.
I wanted to see a more
powerful predicate.
For example, I wanted to
see that it could be used outside ofSwift UI better because, for example.
I don't like this move to us getting rid
of the controller layer.
I prefer to have thecontroller dealing with a
lot of this and then lightly updating.

(31:54):
I'm writing a lot of
controller code and model
code in my view now, and Idon't like that trend, so I was
hoping we get moresupport for outside of
Swift
ui.
One of the things we did getis a very nice support for
previews, and so the new,

Leo Dion (host) (32:10):
Yes.

Daniel Steinberg (guest) (32:11):
that helps us not sorry, I implemented as a macro.
The new support we
got for previews is
very nice.

Leo Dion (host) (32:18):
Yeah.
Yeah.
100%.
Yeah.
I mean, so in my, app I prettymuch have gotten rid of query
in Swift UI just 'cause itdoesn't do what I want it to do.
And I've moved all my SwiftData stuff to observable objects
like the controller essentially.
Right?
And yeah, I

Daniel Steinberg (guest) (32:36):
how are you getting updates from that?
You then reflect to the.

Leo Dion (host) (32:42):
I don't like this answer.
I use notification center.
So there's a way to becauseunderneath, right, it's just core data.
And so I use the core datanotifications to basically know when
something is updated, and then I havebasically a bunch of like listeners
set up, and then that's how I knowwhen the data has been updated.

(33:02):
I think I did

Daniel Steinberg (guest) (33:03):
By the way,
did you see the
announcements of what may becoming to Notification Center?
This is I
think, big news.

Leo Dion (host) (33:12):
Okay.
Go ahead.

Daniel Steinberg (guest) (33:13):
a notification cannot be sendable because
a notification is a reference typeand it create, contains a user info
dictionary, which can contain anything.

Leo Dion (host) (33:24):
oh God.

Daniel Steinberg (guest) (33:24):
And so there's

Leo Dion (host) (33:25):
my existence is these dictionaries with s Yes.
Anyway, sorry.

Daniel Steinberg (guest) (33:30):
so so there's this new proposal to have
this notification.
I don't remember if it's notification
center, do message or notification
message, which is sendable.

Leo Dion (host) (33:41):
Okay.

Daniel Steinberg (guest) (33:41):
It's a great solution to use with Async, and now I
can use Notification Center in avery powerful way and not be sending
things across actor boundariesand getting all those warnings.

Leo Dion (host) (33:54):
To me, like the ba like that, like I don't want to get
into a Sendible rant, but like thefact that there's so much old code
that's like an object based or anybase that's there's no way to tell
if something is sendible or not.
It's just been a real pain in the butt.
So yeah, that's gonna be awesome.
But.

Daniel Steinberg (guest) (34:12):
one of the nice things if you have
architected your app, which Itend to using lots of packages.
You can address those one package ata time and update one package at a
time, and I find that very powerful.

Leo Dion (host) (34:25):
Yeah, so speaking of Swift Data, that's kind of where
I'm in the middle of right now withmy app, my VM app bushel is the fact
that I I ended up having a sessionand they're like, yeah, you can't do
persistent model cannot be sendable.
I think we've even talkedabout this offline.
But so now I have tochange a lot of my code.

(34:45):
To basically take into the factthat it cannot be sendable and
do everything in closures orgrab the persistent identifier.
And that to me has been a bigpain in the neck is like to me.
So I
would think Swift Data wouldbe even more friendly to async
away considering how new itis, but it's like kind of not.
And I think, we specifically talkedabout the fact that like why is

(35:07):
model, why are models, classes
and things like that.

Daniel Steinberg (guest) (35:10):
Well, and that's what I was gonna say is that's
the difference between the Swift teamand the Swift UI team is Swift Data, I
thought would've been the opportunityto make these things value types.
And then they would'vebeen easier to send.
Although we might have gotten intoissues with non copyable but it
would be nice to be able to sendthese things across And so you end

(35:32):
up sending sort of a representationof them so that you can get updates.

Leo Dion (host) (35:37):
Right, right.
Yeah, that's kind of what I'm doingis just grabbing the persistent
identifier and using that and thenkind of co copying the fields.
but that's so it feels likeso awkward and it could be so
easily done in another way LikeI get that it's a class because
underneath It's a reference to some.
SQL light file somewhere.

(35:58):
Right.
But at the same

Daniel Steinberg (guest) (35:59):
we know that

Leo Dion (host) (36:00):
Right, right.
I know.
I'm agreeing.
Yeah.

Daniel Steinberg (guest) (36:03):
So,
so all of what?
All of what you justsaid, I lost my thought.
I'm sorry.

Leo Dion (host) (36:11):
that's okay.
I mean, I kind of think that's
what I feel like they're
trying to push away
from classes as much as possible andget everything to be a non copyable,
structor or an actor.
it almost feels like That's
kind of the trend in a lot of ways.

Daniel Steinberg (guest) (36:28):
I'm, so a lot of what we have to do
is put things on the main actor.
It looks like we're puttinga lawn on the main actor
until you actually go throughdebugging or look at instruments,
and you find out that things arepushed off the main actor when they
can be every time you hit in awai.
And so
at first it feels like we're puttingeverything on the main actor and why

(36:51):
isn't
this slowing things down?
But when you dig into theasync, sometimes you find
out, yeah, but when thesystem can push things off to
a background thread, it's happening
for you,

Leo Dion (host) (37:02):
Oh, okay.
That's really interesting.
Makes sense.
Yeah, so I wanna talk a little bitabout your Swift craft talk that
you did in England a few months ago.
Macros.
Macros are one of those things whereI'm afraid they put, they invest.
Apple invested a lot into it.

(37:23):
And then we haven't heard a lotas far as making app, making,
building at macros better.
But then at the same time,we do see a lot of macros
everywhere whenever they can.
Where do you, like, where doyou see the future of macros
and where they're headed?

Daniel Steinberg (guest) (37:40):
So one of the problems with Swift evolution is we see
everything that's being added to Swift,and we think everything is for us.
Some of the things aren't for us,like you can go through the rest of
your life and never write a macroand still benefit from macros.

(38:00):
Pound preview in Swift UI isa macro that got rid of so
much dumb boilerplate code.
It's, in my opinion, the perfectmacro and so Swift testing at Sweet
at test.
The tags are at
tag pound, expect pound

(38:20):
require.
These are all macros.
And so I'm using it all the time.
Do I have to be writing my own?
And also the ones that we write, asopposed to the ones that Apple writes,
we have to bring in Swift syntax,which slows down a clean build.
And so, although I liked writingmacros and I still write macros,

(38:43):
I don't think they're for us primarily.
I think they help.
I think they help make theenvironment we live in better.
But before you write your own,you really should question,
can you do it any other way?
Could you do it with a function, for
example?
Could you do it with a protocol?
And so if there's another wayto accomplish what you wanna

(39:04):
accomplish, then don't reach for a
macro that macros are great when they'reused for What they should be used for.

Leo Dion (host) (39:13):
What do you think is a great example of
when you should create a macro?
Do you have a checklist of

Daniel Steinberg (guest): so my example was pound (39:17):
undefined
preview.
'cause if you think of pound previewbefore pound preview, we had to
come up with Some name and we tendedto name it whatever the view was.
Under
previews, we had to conform to
something.
Conforming to that thing meant we had to
implement something, and sowe implemented this computed

(39:39):
property inside of the struct,and all we cared about was
what are we presenting in thepreview pound preview says type
pound preview, and give methe thing you're presenting.
End of the day, that'sa beautiful macro.
That's a great use of
macro.
So, in Swift Data for example,they gave us a way of creating

(39:59):
something that would present data
in a macro.
And most of what we have to type in is
nonsense.
And I would've done this in a
function
except if you
give me a
function that accepts a vari
inside the function that's
transformed into an array.
I can't then turn aroundand call apple's function

(40:20):
that requires a very at,
so I had to create a macro,and so I created a macro,
that
makes adding preview
data really trivial and
gets rid of a page of this boilerplate,
which is just it's, not that
it's not important, but it'snon-interesting and it never changes.

Leo Dion (host) (40:38):
Do you think at its core macros are a way to bring
the dyna dynamic abilities ofObjective-C into Swift, essentially.

Daniel Steinberg (guest) (40:48):
I,
don't
think that the dyna, I think thatthe dynamism of Objective-C is very
powerful and a
runtime thing.
So macro is a compile
time thing.

Leo Dion (host) (41:02):
The reason I'm saying that is like with Objective-C, you could
change stuff on the fly all the time.
And there's certain thingsYou could do with Objective-C
reflection wise, for instance.
And it seems like with macros, it'sa way of like basically changing
a certain type on the, kind of, onthe fly, but not really like by,

(41:24):
by basically modifying the code.
Because it's

Daniel Steinberg (guest): I wanna stress it. (41:27):
undefined
It's a compile time issue.
It's not this change isn'thappening at runtime.

Leo Dion (host) (41:33):
right, right.
Obviously.
Yeah.
Yeah,

Daniel Steinberg (guest): well, it not obviously (41:35):
undefined
be it needs to be,
say, stated,
right?
Because that's Objective-C.
We could do stuff at runtime.

Leo Dion (host) (41:42):
Yeah.
Yep.
Yeah, that's a good point.
Before we close out you got.
Books.
You got a books
a book coming outspecifically on Swift testing.
Do you we'll put a link, you'llhave a pre-order link that we
can share with our audience.
Okay.
Awesome.
Do you have any other books coming out?
Probably updates right.

Daniel Steinberg (guest) (42:01):
I have both books and I have updates.
What I'd like to do is make surethat my, my books are still relevant.
So I updated my Swift intro bookfor the last time I've End of Life
Did, but it now works in Swift six.
I don't think the intromaterial will change.
I'm going to write a Swiftsix book, which is for sort
of that next level stuff.

(42:22):
What have we gotten,not just in Swift six?
'cause a lot of
what we call Swift six, we got inSwift five, nine five, ten five.
You know, it's been evolving
towards this.
And so I want to talk
about that
just because I'm an idiot.
I don't know if you've noticed, my lastbooks have all used sort of a detective
theme and so I've had thisrunning detective story.

(42:43):
The Swift six book willhave a Winnie the Pooh theme
because of the Winnie the Pooh
book.
Now we are six, of course, now we
are Swiss
six.
And
so

Leo Dion (host) (42:52):
Right, right, right.

Daniel Steinberg (guest) (42:53):
looking forward to playing with that.
I have to update my
async book to Swift six, mymacros book to Swift six, my data
flow in Swift UI, book to Swift six.
and I may also update,
it should be a lightupdate, the functional
book and the Swift UI kickstart,and those will be end of
life with those updates.
But the Async

(43:13):
book, the data flow and
Swift UI and the Macros book, those
will continue to live.
I'll continue to update those.

Leo Dion (host) (43:20):
Awesome, and we'll put links to those
in the show notes as well.
And then you have a bunch of conferenceappearances you'll be making.
Mostly Europe, I think, right?

Daniel Steinberg (guest) (43:29):
Mostly Europe.
I'm just a stranger in my own land.
But so, so
the easy answer is if I'm at aconference, it's because I was invited.
If you ask me, I generally say yes.
And so if I'm not at a conference,
'cause I wasn't invited, and so,I'll be going to Swift Island and
ISW
uk.
Those will probably be before this

(43:51):
post, I'm doing
a Swift
testing workshop at iOSDevUKand then at NS Spain.
I'll also be doing a talk at NSSpainon macros and another talk on
macros at server sideswift at the end of
September.
And so,
Busy time coming ahead.
And then
finally in October, Ihope to see you in Bologna

(44:12):
for Pragma call,
which is just also,these are all just such
great conferences, greatcommunity and amazing organizers.

Leo Dion (host) (44:20):
And I will see you in London for Server side Swift.
I'll be doing my talk on how does ServerSide Swift work out in the real world.
And I literally mean outbecause it's a fitness app.
So yeah, I'm reallylooking forward to that.
We'll have links to allthat stuff in the show

Daniel Steinberg (guest) (44:37):
It'll be great to see you there and
maybe we'll do a meal together.

Leo Dion (host) (44:40):
I know.
Yes, I know.
Locks, locks and bagels like, youknow, I'm like addicted to it.
Thanks to you So.
Daniel, thank you so much for coming on.
This was fantastic.

Daniel Steinberg (guest) (44:49):
My pleasure.

Leo Dion (host) (44:51):
W can people find you online?

Daniel Steinberg (guest) (44:53):
Dim sum thinking pretty much everywhere.
Dim sum thinking.com includeslinks to everything I do.
And then on socials,I'm blah, blah, blah.
Dim sum thinking.

Leo Dion (host) (45:02):
Yep.
Awesome.
People can find me on.
Social media at Leo Dion.
At Leo Dion at C Im on Mastodon.
If you're watching this onYouTube, please and subscribe.
I'd really appreciate it.
As you can see, I'm in, can you see?
Let's see.
No, maybe not.
I'm moving.

(45:22):
So, I don't know when this episodewill come up, but hopefully soon.
You know, where it'sstill relevant, so, yeah.
Yeah, that'll be my busy project
for the next few weeks.
Thank you everybody for joiningme, and it was good to see you.
Bye.
Advertise With Us

Popular Podcasts

On Purpose with Jay Shetty

On Purpose with Jay Shetty

I’m Jay Shetty host of On Purpose the worlds #1 Mental Health podcast and I’m so grateful you found us. I started this podcast 5 years ago to invite you into conversations and workshops that are designed to help make you happier, healthier and more healed. I believe that when you (yes you) feel seen, heard and understood you’re able to deal with relationship struggles, work challenges and life’s ups and downs with more ease and grace. I interview experts, celebrities, thought leaders and athletes so that we can grow our mindset, build better habits and uncover a side of them we’ve never seen before. New episodes every Monday and Friday. Your support means the world to me and I don’t take it for granted — click the follow button and leave a review to help us spread the love with On Purpose. I can’t wait for you to listen to your first or 500th episode!

Crime Junkie

Crime Junkie

Does hearing about a true crime case always leave you scouring the internet for the truth behind the story? Dive into your next mystery with Crime Junkie. Every Monday, join your host Ashley Flowers as she unravels all the details of infamous and underreported true crime cases with her best friend Brit Prawat. From cold cases to missing persons and heroes in our community who seek justice, Crime Junkie is your destination for theories and stories you won’t hear anywhere else. Whether you're a seasoned true crime enthusiast or new to the genre, you'll find yourself on the edge of your seat awaiting a new episode every Monday. If you can never get enough true crime... Congratulations, you’ve found your people. Follow to join a community of Crime Junkies! Crime Junkie is presented by audiochuck Media Company.

Ridiculous History

Ridiculous History

History is beautiful, brutal and, often, ridiculous. Join Ben Bowlin and Noel Brown as they dive into some of the weirdest stories from across the span of human civilization in Ridiculous History, a podcast by iHeartRadio.

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

Connect

© 2025 iHeartMedia, Inc.