All Episodes

July 18, 2024 42 mins

I had a great time chatting with Chris Eidhof about his work with objc.io and his latest project, the SwiftUI Field Guide. We discussed SwiftUI's layout system and the exciting new features from WWDC 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)
License: CC BY (http://creativecommons.org/licenses/by/4.0/)

  • (00:00) - Chris's Journey in iOS Development
  • (03:39) - SwiftUI Field Guide
  • (24:11) - WWDC 2024
  • (36:14) - Is SwiftUI Production Ready?
Thanks to our monthly supporters
  • Edward Sanchez
  • Steven Lipton
.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.

(00:00):
Before we begin today's episode,I wanted to let you know I'm
open to new opportunitiesthis summer and fall of 2024.
If you're looking for someone who hasan expertise in swift, whether it's
iOS, watch, os, tv, vision, Mac Os, orServer side, swift, reach out to me.
You can find me@brightdigit.com and youcan reach out to me there, or you can

(00:24):
just email me at leo@brightdigit.com.
Thank you so much, and I hope youenjoy the rest of today's episode.
Welcome to anotherepisode of Empower Apps.
I'm your host, Leo Dion.
Today we're joined with Chris Eidhof.
Chris, so happy to have you on.

(00:44):
Thank you for coming today.

Chris Eidhof (guest) (00:46):
Thank you.
Thank you for having me.
So great.

Leo Dion (host) (00:49):
For people who don't know who you are, I'll let
you go ahead and introduce yourself.

Chris Eidhof (guest) (00:54):
Sure.
Yeah.
I'm Chris and I've been doingiOS development since iOS two.
Somewhere around iOS three orfour I thought oh, we're over it.
Like it's, this was it.
And I never guessed I wouldstill be here doing iOS and Mac
and Swift and all of that stuff.
And yeah at some point I started UICon conference in Berlin and out of

(01:16):
that came objective c io and magazinewe ran back in the day for two years.
And then.
We started writing books.
So we as Florian and Danieland me the creators of objc.io.
And then yeah, then at some pointa video series called Swift Talk.
And the, my most recent projectis the SwiftUI Field Guide.

(01:38):
And yeah, but I'm, I've been in thecommunity for a long time now, I
think and really enjoy it, reallyenjoy the people there and yeah.

Leo Dion (host) (01:46):
Yeah.
And I love the work you've been doing onobjc.io, swift talk and all that stuff.
It's been fantastic.
Did you, when did you startwriting like educational material?
What year would you say?

Chris Eidhof (guest) (02:00):
Yeah.
This was I think 2013.
So we started UIKonf theconference because I really
wanted to go to a conference, but.
In Berlin, there was noneexcept for German speaking ones.
And I'm not a native speaker, and soI wanted to go to an English speaking
one, and so I had to organize it.
And then the day after theconference, there were a couple of

(02:22):
us sitting outside feeling guiltybecause we were just chatting and
not participating in the hack day.
But that's where westarted the magazine.
And I think that's where we startedwriting sort of educational content.
I.
Didn't really know too much,like in depth stuff at all.
But Florian and me, we hada lot of time in our hands.

(02:42):
And Daniel, who was also part ofthat team, he knew everything.
Like he knew all the hehad all the knowledge but
didn't have that much time.
And so the combination was perfectbecause we could just write stuff and
he'd be like, oh no, this is all wrong.

Leo Dion (host) (02:56):
Yeah.

Chris Eidhof (guest): And that's how you learn. (02:56):
undefined

Leo Dion (host) (02:57):
yeah.
That's awesome.
What are you, what'syour native language?

Chris Eidhof (guest) (03:02):
Dutch.
Yeah.
Which is the same as German almost.

Leo Dion (host) (03:05):
Deutsch Dutch, it's all the same.
Yeah.
Objective C Swift, it's all the same.
Yeah.
So it's funny that you said 2013'cause that was like the year before
Swift came out and you must havebeen like, oh, we started this domain
objc.io and now there's a new language

Chris Eidhof (guest) (03:20):
Yeah, somebody immediately grabbed swift.io
and then we stuck with the name.
And so we write these books likeabout Swift and I've heard of
people not buying the book becausethe first thing on the cover is
objective C and like the, it makespeople not want to buy the book.
But yeah, it's fine.
They're loss.

Leo Dion (host) (03:38):
Yeah, exactly.
So today we wanted to talk about yourfield guide, your SwiftUI field guide.
You wanna explain exactlywhat it is and what's it for.

Chris Eidhof (guest) (03:48):
Yeah.
So out of this educational stuff at somepoint we started doing workshops and I
workshops about SwiftUI and I realizedit's very, like there's not a lot of
really good documentation by Appleitself on how SwiftUI actually works.
There's.
WWDC talks, there's API documentation,but not nothing explains the

(04:09):
layout system, for example.
And so our workshops have beenfocused on that, but it's also been
a frustration for me because I don'tthink people should be like paying
a lot of money to, to attend aworkshop with their company like this.
This information should beopen and should be free.
And so that's why Icreated the field guide.
I wanted to create aresource where people.

(04:32):
Can read about the layout system,understand it, link to it to send it
to their coworkers or whoever needsit, and also play around with it.
And there are a lot of these really goodexplainer websites out there these days.
And I got really inspired by that.
So for example, if you wanna look atthe padding modifier I made it so that.

(04:55):
In all the examples, if thereare any tweakable values, you
can adjust them with a slider.
And I picked that upsomewhere in a talk.
I don't know if it was BrettVictor or one of these people
who's really good at this.
And by having a slider you cango through so many intermediate
values in such a short timethat you really get a feeling
hopefully for how this stuff works.

(05:16):
And and yeah, that's what I'vebeen really focusing on trying to.
Explain some of the top thesetopics in a very visual way.
That's hopefully fun to interact with.

Leo Dion (host) (05:26):
When it comes to the field guide, so is the field guide
completely free for anyone to consume?

Chris Eidhof (guest) (05:32):
Yes.
So currently it's completely freeand I think I would like to be able
for this to be a project that can I.
Carry its own weight sothat it pays for itself.
I like, so it is, it's a, itis a, I think it's a big loss
machine currently every month.
But but we'll get there at some point.
I think I wanted ideally I wouldlike to give away as much as I could,

(05:55):
but of course I need to pay thebills as well and I have two kids.
And like I, I need to make surethat it can sustain itself at some

Leo Dion (host) (06:02):
that makes total sense.
So what do people not know about thelayout system that they should know?

Chris Eidhof (guest) (06:10):
Yeah, I think it's the mechanics of how it works.
So I'll have people in myworkshop who've been doing SwiftUI
in production for two years.
I.
And and they know how to use it, right?
And so they can get theirstuff done and they can make it
work, and then it doesn't work.
And then they have this repertoireof tricks that they can apply.
Like you can try maybe a fixedsize or one of these things,

Leo Dion (host) (06:34):
geometry

Chris Eidhof (guest) (06:34):
to reader.

Leo Dion (host) (06:35):
and fixes everything.

Chris Eidhof (guest): Yeah, see if that works. (06:36):
undefined
Or maybe I could use analignment guide or maybe not.
Like I didn't really know.
And so that's my experiencethat people come in with a
pretty sound understanding,but not really at the core.
And it's actually reallysimple, the whole layout system.
It's this dance of a parent proposesand a child response and this's
almost the only thing to it.

(06:57):
And then every view responds ina different way to the proposals.
And so just.
Just the idea of that, I think, andthe fact that you take your swift
code and that gets turned into atree, I think is either a complete
eye-opener or it finally helps peopleto make the whole thing click, right?
Like they, they know this, butthey don't really, and then I

(07:19):
can show them the last finalbits and then it all makes sense.
Like that's very rewarding ifthat happens ever during teaching.
And so that's.
What I noticed that people justoften don't really understand
and hopefully this will help.

Leo Dion (host) (07:33):
When did it click for you that you were like I get this,

Chris Eidhof (guest) (07:37):
Oh,

Leo Dion (host) (07:38):
how to communicate this to other people.

Chris Eidhof (guest): there is no one moment. (07:40):
undefined

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

Chris Eidhof (guest) (07:42):
But I can tell you there's a few, there's a few
moments where it's started making.
A little more sense.
Like I remember at some point wewere writing the first edition
of Thinking in SwiftUI and I Iactually did that in like a holiday
home, not far from where we live.
So that I had like isolation,no internet, no nothing.

(08:03):
And I was trying to figure this out.
And then I was rewatching a WWDC videoby John Harper and Dave Abrams, and it
said something like, yeah, and if youpropose this, and I was like, wait.
What if it actually literallyproposes, like, how would that work?
And then I started to figure thatout and what really helped me to

(08:24):
actually understand is trying toreplicate that by implementing myself.
And so that really started to likedoing more and more of that really
helped me to get that click effect.

Leo Dion (host) (08:36):
Before we get into kind of the more in depth of what that
means what was your background as far asdesign and development before Swifty y?

Chris Eidhof (guest) (08:49):
Yeah,

Leo Dion (host) (08:50):
So UIKit, like obviously, but like what else have
you were, did you do besides that

Chris Eidhof (guest) (08:56):
Yeah.
I used to do web development,so mostly actually PHP.
And mostly backend stuff.
I, when I was younger, like a teenager,I would do like the whole thing, right?
HTML, CSS, PHP everything andthe design and make no money.
But like we would build websitesfor like local companies.
And and then and then I went touniversity and there it was super

(09:21):
hascal heavy and that really.

Leo Dion (host) (09:23):
interesting.

Chris Eidhof (guest) (09:24):
Really yeah, enlightened me like I, I did my
masters trying to I came in with thequestion, is this Haskell thing actually
something you could take seriously?
Is this a real thingor is this just a toy?
And it turned out to be real.
And we got, we had thiswas the coolest thing ever.
We had this group of students thatwere super motivated and so we

(09:47):
were the, it was very contagious.
Like we were all like reallygetting into it and like going
to conferences and trying toone up each other all the time.
And the learning Yeah.
In Haskell and the learning in thosetwo years was so intense and so amazing.
And I still like, when Italk to these people now it's
just it's really interesting.
It just I don't knowif I could do it today.

(10:08):
But back then we have a lot oftime and a lot of motivation.

Leo Dion (host) (10:11):
There you go.
Yeah, exactly.
So the reason I was asking is'cause I think like one of the
things you go into it SwiftUI, youhave, you're already your precon.
I've talked about this before.
When it comes to education, one of thebiggest problems is those of us who are
experienced come at it with different.
Mind models of how things work.
If you were doing UIKit, like youhad a specific, you had a better

(10:34):
under, you had a specifically UIKitunderstanding of how layout would work.
And like for me, it's either thator it's gonna end up being CSS.
Because that's I've still do it atthe occasional web development stuff
and I've done a lot of with likeCSS and how CSS talks to pa, like
parents and children, all that stuff.
So I feel like that's one of the.
Not necessarily blockers, but likeparadigm ships you have to let

(10:57):
go is like how Suit UI does itdifferently than other systems.
Do you know what I

Chris Eidhof (guest) (11:03):
Oh yeah.
No, it's it, this is literallywhy we called our book Thinking
in SwiftUI because it does notreally matter how good you are.
ui, you can transfer over almostnone of that knowledge to SwiftUI.
So there's no auto layout, there'sno, the state system is different.
The animation system iscompletely different.

Leo Dion (host) (11:24):
And it's all UIKit underneath, but like it's SwiftUI.
And I think Paul has said this islike SwiftUI is just like a series
of instructions and then eachoperating system draws it, like in
whatever language it uses underneaththe applicate UIKit, whatever.
And it's more it's more like a markupin a sense with the DSL and everything.

Chris Eidhof (guest) (11:45):
It is and I wonder if at some point, like.
The so clearly UIKit will be thereand is necessary like the whole UIV
representable, but like for a lot ofthe basic components, they could just
pull out the rug and re-implementthose in SwiftUI without us noticing.
Like in theory, like it doesn'tneed to stand on top of you.

(12:07):
I could, I think it could move towardsbeing its own thing and everything
is SwiftUI and then it integrateswith your IT if you choose to.

Leo Dion (host) (12:15):
I'm not, I feel like I haven't been in the industry long
enough to see Apple actually do thatwith it, with API, where they're just
like, everybody was using cocoa orwhatever, and it's like all of a sudden
you have to go to AppKit and theneventually everything is an AppKit.
So yeah, I'm sure that'skinda like the long term plan.
But yeah, it would be interesting tosee like them actually pull the rug
out and be like, everything's down.

Chris Eidhof (guest) (12:37):
I don't know if that's gonna happen.
I have no idea.
I think they could, and but let's see.
Maybe they cannot,

Leo Dion (host) (12:43):
I would say five years, 10 years.
Like it's gonna take a while.
Like it's not gonna happen anytime soon.

Chris Eidhof (guest) (12:50):
Yeah.

Leo Dion (host) (12:52):
Yeah, let's get into it.
You were talking about the patternpropose or the parent proposes to
the child and the child implements.
Did I say that correctly?

Chris Eidhof (guest) (13:01):
Yes.

Leo Dion (host) (13:02):
does that, let me see if, let me see if I
understand correctly, and youcould correct me if I'm wrong.
The parent's Hey, I'm a boxthat's 500 by 500 and I want
you to only do the left side.
Or leading I should say.
Is that like how it works andthe child's no, I think I want
to be bigger than you and I'mgonna be 800 by 500, and the child

(13:23):
can just do whatever it wants.
Is that correct?

Chris Eidhof (guest) (13:25):
yeah, almost so the parent proposes, let's say the
parent proposes a size to its children.
And so the root view would belike the whole device, right?
The whole safe area.
And so that would proposethe size of the safe area,
and that's for all time sake.
Say that it's three 20 by four80, and then the child can do

(13:46):
whatever it wants with the proposal.
And so there's different behaviors.
If you have an app that's only arectangle, let's say a yellow rectangle,
it's gonna fill up the entire safe area.
So in, in other words, what it does, it,it just takes the proposal and returns
it and saying, Hey, that's my size.
Things like a padding, say wall.

(14:08):
I'll take the proposal, I'll subtracta little bit and propose that
subtracted smaller version to my child.
And and so then it adds it back upand, to the reported side of the child.
And then you have thingslike H Tech and that.
Those are super interesting, I thinkH Tech and V Stack because what they
need to do is somehow distributeall of that available space, right?

(14:28):
So let's say you have 300 pointsavailable, you have three sub use.
And what the H Tech actually triesto do, roughly is to distribute
that equally to each of the subviews which sounds easy, but in
practice it's actually quite tricky

Leo Dion (host) (14:44):
Yeah, I would imagine yes.

Chris Eidhof (guest) (14:45):
Because, like maybe one of the sub views is only
ever gonna be 10 points wide, so thenit needs to know that before and maybe
distribute the space among the othertwo and do that in the right order.
And so it becomes this really fun dance.
And the reason I think why we needto understand it is mostly we don't.
And then we get into troublebecause it doesn't do what we want.

(15:06):
And then all of a sudden, like youneed to fill in that knowledge and
understand what happened there.

Leo Dion (host) (15:12):
Are there like protocols or something
available that would let us.
Do this ourselves, so that way wecan actually see it in action, if

Chris Eidhof (guest) (15:21):
yes.
Yeah so the layout protocol doesthis, so the layout protocol
lets you do exactly that dance,and it got available in iOS 16.
And the macro has releasedthat came of that and it all
let us write around layouts.
And it's the first time as SwiftU developers that we saw the
proposed view size strict and.

(15:41):
You can actually do layoutsthat are completely no up.
So they just forward everythingand return everything from
their respective children.
But you can print stuffand this is how you can.
Visualize or introspectwhat's happening there.
So if you do this no up layout andwrap every H Tech child in that, you'll

(16:03):
see that the H Tech proposes threetimes to every single child to figure
out, like flexibility and then it
It's really fun.

Leo Dion (host) (16:11):
What other quirks that you think people don't know about how
the layout system works in SwiftUI orthat or not quirk, but necessarily that
doesn't meet the expectation of whatthe typical SwiftUI developer thinks?

Chris Eidhof (guest) (16:26):
I think a lot of people so there's maybe two things.
A lot of people seem to thinkthat this gets translated into
constraints or into auto layout,which is not at all what happens.

Leo Dion (host) (16:36):
SwiftUI just tell directly the UIKit.
This is exactly what I want you todo, and don't shut up and just do it

Chris Eidhof (guest) (16:42):
or not even UIKit, like a rectangle or a text.
I don't think that's UIKit anymore.
It's just,

Leo Dion (host) (16:48):
Oh, okay.

Chris Eidhof (guest) (16:49):
yeah.
So the thing we see on screen, I thinkis I think they call it a display list.
And it's like literally the listof views that needs to be displayed
with their respective frames sothat their position and size and.
So the whole thing that SwiftUI doesis like everything with the layout
system and whatever, the animationsystem just to get the display list out.

(17:10):
And yeah, as for the things thatpeople like, another thing that I
don't think many people understandis that when SwiftUI proposes.
Either of those dimensions.
So either the width or your height couldbe nil and that seems like a funky edge
case, but it's actually really importantto what's happening underneath.
So a nil proposal meansthat the view can become its

(17:34):
ideal size in that dimension.
And so if you propose a nil width, itbasically says become your ideal width.
And this is used everywhere.
So there's the dot fix size modifier.
And that does that for you.
It, it sends you a nil proposal andalso in a scroll view, if you imagine
like a vertical scroll view, right?
You have so much space available,like almost infinitely.

(17:56):
And so this, the vertical scrollview will do a nil height proposal
and tell each of its sub views Hey.
Become whatever heightyou want to be, right?
Become your ideal height.
And this, it's thesame for aspect ratio.
The aspect ratio, modifier uses is tofigure out the underlying aspect ratio.
And so there's a lot to that.
And then I think the other thingthat people maybe don't really get

(18:19):
and who's, that's so understandableis that code that the code that
we write gets turned into trees.
And like that tree is superimportant for the order of proposals
and the order of everything.
And but that's maybe a morefundamental thing than just layout.
Yeah,

Leo Dion (host) (18:35):
Do you two questions.
What, how do lazy collections work?
So we have a lot of theselike lazy grids, lazy stacks.
How do those work and how dothose affect the layout system?

Chris Eidhof (guest) (18:47):
I, so I don't know how they work.
Like I, I can tell you, I can tell youhow I can describe you, like what my
mental model is of them but obviously,like I've never looked at the source.
'cause I wouldn't really know.
I can only I can tell you how they work.
I don't know how they're implemented.
So the,
Yeah, so let's say ifyou have a lazy V stack.

(19:08):
It's not gonna be lazy at all unlessyou have this specific combination of
a scroll view with a lazy stack, andthen let's say a four each in there.
And what it's, what it's going todo is it'll try to create only the
sub views that are necessary to fillup the bounds of the scroll view.

(19:30):
So not the.
The whole region.
But if you scroll to position Y is100 then it doesn't need to render the
first few views only like everythingfrom position a hundred onwards.
And so it's very similar to UI tableview for those that are familiar
with your iki in that it just cre Ithink it creates the views lazily.

(19:52):
And in order for that,the views need to be lazy.
So if you have like a.
A scroll view and then andthen a lazy vs stack and
then a bunch of static views.
I don't think SwiftUI could makethose, could create those lazily.
It's only by having a lazy container,like for each, that it can do that.
And one really interesting thing isthat now with iOS 18, we can create

(20:15):
our own lazy containers using the foureach and using the group modifiers.
So only.
That will be that you chooseto draw will be rendered.
And so it's not so easyto recreate like lazy vs.
Stack, I think but you could do it.

Leo Dion (host) (20:32):
Yeah, I want to talk about that a bit.
So we got this idea of likecustom view collections.
So what I was thinkingis I'll have a case.
Oh basically what I've been doing latelywith Bushel is I create this on Mac app
is I create like a kind of a view page.
No.
Yeah, page view controller, if you'refamiliar with that, where you like

(20:54):
can go page to page like, so I had tocreate my own custom one and I ended
up having to create this identifiableview and then put it in a group and
blah, blah, blah and all this stuff.
This is I'm not gonna needto do all that stuff anymore.
With a view, with a newview collection stuff.
Is that correct?

Chris Eidhof (guest) (21:11):
I think so, yeah, I think you still might need
to make sure that you have stableidentity for your views, but you
can build your own page view out ofthe new group and for each stuff.
And so I
I.
And you could make that lazy,so you could only display
like the current page.
So I did something similar, likea, almost like a low tech version

(21:34):
of cover flow where it displayedlike the middle page and then
the one before and the one after.
And it had a million items andyou can just scroll through them
and it only renders to threethat are currently necessary.
And.
Took a little while to figureout, but it was not very
complicated at all in the end.

Leo Dion (host) (21:52):
Yeah, the pain in the butt part for me was a, I had to create
a function, no result builder, and Ihad to create the identifiable part,
so that way it's actually identifiable.
Otherwise, yeah, it seems tobe working pretty good on the
Mac, so I'm happy with that.

Chris Eidhof (guest) (22:08):
For me it was also the way to make it work
was pretty tricky because you doneed this to make sure that your
views have the stable identity.
Otherwise SwiftUI considers your viewsto be new ones and then you lose any
associated state or animations orany like the, anything like that.

Leo Dion (host) (22:24):
Yeah.
I was using UUIDs and then Iwas like, it would create a new
one every time I mess stuff up.
And I was like, no, I'lljust go back to integer and.
nice.

Chris Eidhof (guest) (22:33):
Yeah.
No, yeah that's a thing for sure.

Leo Dion (host) (22:37):
Is there anything else you wanna talk about the field
guide before we talk about the excitingnew stuff from Dubbo this year?

Chris Eidhof (guest) (22:43):
Yeah.
So maybe one fun thing is that,in order to make it work, I
actually re-implemented wholeparts of SwiftUI in TypeScript.
Also just so

Leo Dion (host) (22:51):
right, you told me this.
Okay, go ahead.
Sorry.

Chris Eidhof (guest) (22:54):
It was, it got out of hand a little bit.
Like I, I was just trying to reimplementsome of the layout system in JavaScript.
And then actually the friends fromuniversity, my Hasco friends, I
met up with them for the firsttime in 10 years and they all
told me to switch to TypeScript.
And so I switched to TypeScriptand it started doing that.
And you can get very closeto, to what Swift is doing.

(23:17):
And so my syntax, I don'tthink it would feel.
Native to anybody who writes typescriptsor TypeScript or HTML, but it reads
almost like SwiftUI and there's alot of quirks and like weird bugs in
there, but I know exactly where theyare and I can work my way around them.
And so I'm the only consumerof the API, so it's fine.

(23:39):
But that's what I did to make it work.
And

Leo Dion (host) (23:41):
That's funny.

Chris Eidhof (guest) (23:42):
and if you look at the website, I think it looks.
Hopefully it looks mostly pretty simple.
Like not very complicated, butalmost everything that's interactive
there, like the whole explanations,for example, on the H Tech page,
this is all sort of fake SwiftUIwhich made it possible for me
to iterate that much quicker.
Like all the animations.

(24:03):
It's all my fake Swift J implementation.

Leo Dion (host) (24:07):
That's amazing.
That's awesome.
Yeah.
Let's get into it.
Besides view collections, what elsewas your favorite thing from dubbed
up this year concerning swifty y.

Chris Eidhof (guest) (24:17):
Yeah, I think that I really like that.
I think.
I like the animations talka lot by Rob and Philip.
Like there was such a good talk and sucha fun thing to watch and so they showed
I think a lot of my favorite things.
There's now the colormixing, I think it, it seems

Leo Dion (host) (24:34):
the gradients.

Chris Eidhof (guest) (24:35):
Yeah so you can mix colors yourself now, where you can
say I have like color A and color B, andI want to, I interpolate between those.
And you can do that in the okay.
Lab color space rather than RGB.
And I think the gradients do thisas well, like even linear gradient.
And then yeah, the whole meshgradient stuff looks awesome.

(24:56):
I think everybody was onTwitter, was writing mesh
gradient editors immediately.

Leo Dion (host) (25:01):
So what's I don't get, I don't get it because, I get it.
Like mesh gradients are cool,but what's the use case for
them besides they look cool.
That's a bad thing.
But like what is there a specificdesign pattern where that's like

Chris Eidhof (guest): Maybe, I don't know. (25:16):
undefined
I think

Leo Dion (host) (25:18):
Okay.

Chris Eidhof (guest) (25:19):
I think they just look cool and they it's hard
to do this without a mesh gradient.
And actually one thing I am reallyexcited about is that almost every,
or not almost everybody, but a lot ofpeople will now be able to move towards,
I was 17, last year's release, but

Leo Dion (host) (25:35):
makes a big difference.
Yeah.

Chris Eidhof (guest) (25:37):
it makes a big difference.
And then we get shaders and I really,I don't understand shaders well enough
but I think those, they I understandthem well enough to know that it
has a lot of potential and so I.
My thought was that meshgradients would be pretty easy
to implement using a shader.
And like always, it's probably oneof these things that's maybe easy

(25:59):
for the first 80% and then to get itright, it's like a year more of work.

Leo Dion (host) (26:05):
Have you done anything with metal or have you
even have the desire to Okay.
Because that stuff gets in right.

Chris Eidhof (guest) (26:14):
I've I, it is still hard for me, all
the math and all the matrixes.
I picked up a book on I had funnything, I have it lying right over here.
I picked up a book on on matrix andlinear algebra and all of that stuff.
Yeah.

Leo Dion (host) (26:28):
I don't miss that stuff.

Chris Eidhof (guest) (26:30):
I would want to understand it better, but I don't.

Leo Dion (host) (26:34):
Okay, so let's go over some of the things
we got with 50 Y this year.
There's a new tabexperience for the iPad.
What's, do you have anopinion on that at all?

Chris Eidhof (guest) (26:44):
I know I've not owned an iPad for, what is it, 10 years

Leo Dion (host) (26:49):
Yeah.

Chris Eidhof (guest) (26:50):
maybe?
And so no I don't really like, sointo all the little details in SwiftUI
that I consider those things tobe more pla platform than SwiftUI.
And so it, I feel like it'soutta scope for what I do.
I struggle trying to understandall of the the fundamentals
of SwiftUI even and yeah, I

Leo Dion (host) (27:10):
It's cool and I think it's been a long time coming,
'cause I think people don't really usetabs as much as they used to anyway.
So it makes sense that they bumped'em up to the top and put them out
of the way, which I kinda like.

Chris Eidhof (guest) (27:23):
Yeah.
I think,

Leo Dion (host) (27:25):
yeah, go ahead.

Chris Eidhof (guest) (27:26):
oh, no, I was gonna say maybe one thing I, that I, so
there's maybe two things that I reallyenjoyed it that were new is that sort
of, that we now get for adding things.
Sorry.

Leo Dion (host) (27:37):
You mean entries?

Chris Eidhof (guest) (27:39):
Yes.
Yeah.
For, so for, we get this for environmentvalues, for what else Is it like
all the trait stuff like the layoutvalues and it just so much nicer.
Like it's so much work totype in an environment key.

Leo Dion (host) (27:54):
There's so much in bushel, there
is so much boilerplate code

Chris Eidhof (guest) (27:58):
I know.
Yeah.

Leo Dion (host) (27:59):
Like I created so many environment values and it's copy paste.
There you go.
It's per, it's not perfectfor a macro, honestly.
Like it makes total sense.
Yeah, that's that's awesome.
Unfortunately I won't be able to use it.
I guess could I use it?

Chris Eidhof (guest) (28:13):
I think you could.
Yeah, I

Leo Dion (host) (28:14):
because it's got, yeah, 'cause it's a back deploy.
'cause it's a macro, it'snot like it's a new API yeah.
Technically I could use it.

Chris Eidhof (guest) (28:22):
Yeah.
And even if you couldn't, youcould write your own macro
and do your own version of it.

Leo Dion (host) (28:27):
Exactly.

Chris Eidhof (guest) (28:27):
it's like this would be a very good
starter macro to write also forpeople who wanna get into it.
I've been doing a little bit of macrodevelopment and I found it very hard.
Just so much by the plate.

Leo Dion (host) (28:41):
It is really hard.
Swift and Texas is really hard.
Yeah, I agree.
But that's a perfect one, like you said,

Chris Eidhof (guest) (28:48):
Yeah, no, it is.
Yeah.
And I was gonna say one other thingthat I enjoy that they added is the
the new geometry change thing whereyou can measure the geometry of a view.
And this is the stuff we would alwaysteach in a workshops where you do an
overlay in a geometry reader and acolor clear and a preference or an
on change or something like that.
And.

Leo Dion (host) (29:07):
right.

Chris Eidhof (guest) (29:08):
all of that stuff got so much simpler.
Now, if you wanna just measurea single view, you can now do
that in two lines instead ofsix lines And a preference key.

Leo Dion (host) (29:18):
Yeah.
Have you done, is there anything?
So there's the new Swift, speakingof macros, there's the new swift
preview macros for like data,like test data, essentially.
I,

Chris Eidhof (guest) (29:29):
Oh yeah.

Leo Dion (host) (29:30):
that looks awesome.
I still have issues with trying to getpreviews to work half the time, but

Chris Eidhof (guest) (29:35):
You do?
Yeah.
They work for me but I'm not a typicaldeveloper because we always make like
new projects and And so my projectsare typically not very big and like
for small projects that work great.
And I think I mean it does take a littlebit of setting up I think you, you wanna
keep your previous very simple in thesame way that you wanna write code.

(29:58):
That's easy to unit test, where

Leo Dion (host) (30:01):
Yeah,

Chris Eidhof (guest) (30:01):
if your previews need a lot of dependencies
and like networking and allof that, it's just not really
worth it and it's hard to use.
But if your previous can be superisolated from that, then you can, you
might be able to make it work for you.

Leo Dion (host) (30:15):
Yeah, you sound just, Brandon said that when he was on here he
was like, yeah, if you can like previewsand unit tests all, if you can separate
your dependencies out, it's gonna makeit a lot easier for you in the long

Chris Eidhof (guest) (30:26):
Exactly.
Yeah.

Leo Dion (host) (30:29):
did you do, have you done any widget stuff?

Chris Eidhof (guest) (30:32):
I have not.
No.
I wish and I wanna build appswith widgets, and I know people
have problems with this, right?
Like people struggle on Slackwith getting the widgets to work

Leo Dion (host) (30:42):
update and having him inter, because you can
interact with him at least sincethe last version, I wanna say.

Chris Eidhof (guest) (30:48):
yeah, maybe.
Yeah.
I don't even have let me check.
I think I have.
I don't, no, I don't haveany widgets on my phone.
Even.
I'm super,

Leo Dion (host) (30:57):
Oh my gosh.
Not even a photo of your kids.
Come on.

Chris Eidhof (guest) (31:01):
no, it's on my home screen and on my lock screen,
but not on my, I don't have widgets.
No.

Leo Dion (host) (31:06):
gosh.
Okay.
We should cut that out.
That's so embarrassing.

Chris Eidhof (guest): Get it set up tonight. (31:10):
undefined

Leo Dion (host) (31:11):
You're still on iOS 16 or 16?
Yes.
17.
I always get confused.
There's so many.

Chris Eidhof (guest): I'm also very hesitant. (31:19):
undefined
I don't know, like it I justhave the one phone and I don't
wanna lose like my iCloud stuff.
Or

Leo Dion (host) (31:28):
Oh, that makes sense.

Chris Eidhof (guest) (31:29):
And yeah.
And it's the same with, I used gui,Rambo's virtual machine thing, so
virtual body to test out the newversion of Macs, which was awesome.
And I, it was it worked super smoothly.
It's absolutely worth it.
We should link to that in the show notes

Leo Dion (host) (31:46):
No, we should link to Bushel.
Why would I wanna link to Virtual Buddy?

Chris Eidhof (guest) (31:50):
Oh, sorry.

Leo Dion (host) (31:51):
Oh my gosh, Chris.

Chris Eidhof (guest) (31:53):
No.
I think there's, it isa big world out there.
So really wanted to testout the AI stuff in Xcode.
But that doesn't workin a virtual machine.

Leo Dion (host) (32:02):
oh yeah.
'cause okay, that makes sense.
Yeah.
It's cool.
It's fine.

Chris Eidhof (guest) (32:07):
I've, so I've

Leo Dion (host) (32:09):
I haven't been super impressed with it, but I also
haven't been like disappointed in it.
I'm just like.
It's better than whatwe had before, but Yeah.

Chris Eidhof (guest) (32:18):
I know people are gonna hate this, like some people
are, but I've used copilot a wholebunch in vis Visual Studio Code for

Leo Dion (host) (32:26):
If you've been doing TypeScript Yeah, exactly.
It is totally awesome.
Yeah.
Yeah.
So I build web front ends for myapps and we use, I use TypeScript
and it's awesome that CSS HT ML.

Chris Eidhof (guest) (32:40):
Yeah.

Leo Dion (host) (32:41):
that's the, that is Chris, you're gonna, you're
gonna be disappointed with the

Chris Eidhof (guest) (32:45):
Okay.
Yeah.
Let's see.

Leo Dion (host) (32:46):
to copilot, copilot is much better.
Now, obviously, copilot like hasthe entire database of all the
code on GitHub at its disposal,whereas the Swift assist stuff is
not for pri good privacy reasons.
You get what you get.

Chris Eidhof (guest) (33:03):
So my favorite moment was when I
was, so I actually have I don'tknow, seven or eight different
re-implementation of Swift unitthat all do a different part, right?
Like a maybe the HStack layoutor maybe one has like the state
system or the animation system andall are broken in their own way.
But I took my HStack layout algorithm inSwift and I pasted it in my TypeScript

(33:27):
file because I wanted to port it rightand I wanted to have a reference there.
And I started typing.
Copilot translated that wholealgorithm for me, line by line
from Swift into TypeScript.
And it was like, so good.

Leo Dion (host) (33:42):
That's amazing.
Yeah.

Chris Eidhof (guest) (33:44):
I don't trust it to write my code.
I trust it to help me write my code.
And I don't feel like you couldlet those things like write
code and then just run it.
Like I review every single lineand I try to really understand it.

Leo Dion (host) (33:58):
Could you imagine if we had a co-pilot for writing macros?
Do you know how mucheasier that would be?
Like that would be a perfect exampleof like where co 'cause there's just
like you sat, there's so much pre-codethat like you have to do over and
over again for swift syntax and ifChatGPT had knowledge about how Swift
syntax worked, that would be amazing.

(34:18):
That's a free idea for anybodywho's watching or listening to

Chris Eidhof (guest) (34:21):
that would be

Leo Dion (host) (34:22):
because Yeah.
Yeah.
So yeah, definitely if you wanta good VM app, you want bushel.
If you want not that great.
I try Virtual Buddy, but.

Chris Eidhof (guest): I, I've not I'm sorry. (34:33):
undefined
I haven't used bushel yet, soI'll put in a good word for a
virtual body and I also use,yeah, more comp competitors, but

Leo Dion (host) (34:43):
Yeah.
Yeah.
What was I gonna say?
So the other, the only otherthing I had from SwiftUI this
year was scroll position.
Is that what's your opinion on that?
I know a lot of people wanted it.
Is it that helpful?

Chris Eidhof (guest) (34:55):
Yeah, I think we could like if you know the tricks, you
could do a lot of that stuff already.
And so I think it's just nicethat they made this a lot simpler.
Like I think I.
Scroll views are for me, like almostlike the thing that, that makes iPhone,
iPhone and like being able to work withthose effectively is very necessary.

(35:16):
And I think, I don't think peopleneed to resort to these weird
hacks that we've been doing tomake, like reading the scroll
position and setting the scrollposition, like all of that, I think.
These are big quality of lifeimprovements that, that were necessary.
And I think there's stilla whole bunch more, right?
Like in UIKit, we could do so manymore things that we could now do

(35:39):
in SwiftUI and I think there'slike this whole backlog of things
that the SwiftUI team needs to do.
But I'm also very happy that well.
Like I, I'd rather haveit today than tomorrow.
But I'm really happy that theytake their time to find like
the proper APIs and all of that.

Leo Dion (host) (36:01):
Yes.
Yeah.

Chris Eidhof (guest) (36:02):
I'd rather have the feature and maybe a
little bit later and then haveit done well than rush it out.
At least that's whatit feels like to me.
Other people might havea different opinion there

Leo Dion (host) (36:14):
mara had a really good talk at Swift Heroes
when I was there last year aboutbuilding is SwiftUI prediction.
Production ready.
And one of the things that he had inhis slide was some of the crazy names
for methods and in UIKit and how like.
Like you're talkingabout taking your time.

(36:35):
Like with UIKit, there is somereally wild names for like methods.
I'll post a link to the video,but it's pretty hilarious.
And like thankfully they're nottaking that approach with Swift.
They're

Chris Eidhof (guest) (36:48):
No, I.

Leo Dion (host) (36:49):
there's a lot of benefits to that.

Chris Eidhof (guest) (36:52):
Yeah, and like the whole production ready
is also like a big topic, right?
There's still people going out todaycomplaining about this and I think, if
I am personally, I'm much faster withSwiftUI, and yes, there are things that
I cannot do today, but that's okay.
I can always drop down to UI ikior App Kit and like the iteration
speed that you get is amazing.

(37:13):
The weird thing to meabout Swift Joy is that.
I, it, you could you move along and thenyou hit a roadblock and you conquer it
and then you go and then you continue.
And then sometimes the roadblocksare a little bit bigger and with
swift eye it feels like you'removing along much quicker.
But then when you do hit a roadblock,it's like a massive brake wall.
And it's a bit harder to climb

Leo Dion (host) (37:33):
percent.

Chris Eidhof (guest) (37:34):
yeah.
That's like a big difference.
If it doesn't really do what youwant it to do, then it can be
definitely a bigger challenge.

Leo Dion (host) (37:42):
I do wanna talk about that a bit, which is, you
mentioned dropping down to UIKit.
How does that affect the layoutsystem and working within
the framework of SwiftUI?
Because we all have todo it at some point.
Or AppKit, in my case.

Chris Eidhof (guest) (37:58):
yeah, I think it's it's quite similar.
Now we can, for our representable,we can use, also something we
can implement size that fits,I think, if I'm not mistaken.
And there we can basicallywrite our own logic.
I can quickly look it up, butthere we can write our own.
Yeah, you can implement size thatfits for a view, and then you can

(38:19):
write whatever logic you want.
You could query your UI view, youcould write your own logic there, or.
Whatever you think is necessary.
And it used to be possible alsobefore size it fits was public.
So you, and like I, there wasI think an underscored method
that would let you do this.

Leo Dion (host) (38:39):
Okay.
Okay.
Speaking of underscore methods, haveyou used any of the print changes stuff
to track like your views being redrawn?
Do you know what I'm talking about?

Chris Eidhof (guest) (38:49):
Yeah.
Yeah.
No that's necessary.
And like the self that underscoreprint changes is what you mean, right?
Yeah, I've used that.
I don't use it that often.
Like I, I typically write my views.
I think I know why they re-renderI'll add print statements a lot
to see if that's true, but like

Leo Dion (host) (39:08):
that there is more to do with how the data changes underneath
and how it then triggers a redraw.
It's not necessarilya layout thing, right?

Chris Eidhof (guest) (39:18):
Exactly.
Yeah.
This is only about trackingwhy why you view re renders.

Leo Dion (host) (39:23):
right.

Chris Eidhof (guest): And yeah, no I use that. (39:23):
undefined
The other underscored methods I would,I, I used to use were the very views
ones, but that's what we now get withgroup sub views and for each sub.
And other than that I'm a littlebit afraid to use too much
like private stuff only maybeto understand how things work.

(39:44):
And maybe one cool thing that peoplecan do if you wanna know more about
SWIFT ai is you can actually, inthe terminal, you can CD into your
Xcode app, and then you can find theSWIFT interface file for SwiftUI.
So you could do like a find.
Command and find likea file called SwiftUI.
And then the SWIFT interfacefile for that framework.

(40:05):
And it'll show you a lot of theinternal stuff of how SwiftUI works.
And you could see even implementationsof certain methods and properties.
So if that method hasbeen marked as inline.
It'll have the entire implementationin that SWIFT interface file.
Which is very interesting.

(40:26):
And so one of the things youcould see there, for example,
if you do dot border, call it ared, that's actually implemented
as an overlay with a rectangle.
With a

Leo Dion (host) (40:35):
Oh really?
That's awesome.
Okay.
That makes total sense.

Chris Eidhof (guest) (40:40):
it does.
Yeah.
But once you get it right and it, nah.

Leo Dion (host) (40:44):
Yeah.
Chris, was there anythingelse you wanted to talk
about before we close out?

Chris Eidhof (guest) (40:48):
No.
Thanks for having me.
And yeah, if people are interested,check out the Swift Drive Field
Guide or any of our books or if yeah.
And I hope that's helpful.
If you, if anybody listensand has questions about
these things, let me know.
I'm easy to find.
And my email address iseasy to find and then yeah.

Leo Dion (host) (41:09):
Cool.
Thank you so much, Chris.
You're Chris at M dot obobjective, COBG bjc.io.
We'll have legs to all yourstuff in the show notes.
Thank you again.
This was fantastic.
It's been awesome.
People can.
My peop people can find meon Twitter at Leo g Dion.

(41:30):
Leo g Dion at.
Ma on if you are, mycompany name is Break Digit.
If you're looking for help withany of your apps reach out to me.
I would love to seewhat we can do for you.
If you're watching thison YouTube, and subscribe.
If you are listening to this on apodcast player, please put in a review.
If there's something you wantto hear about, reach out to me.

(41:51):
If you wanna come on and be aguest, I would love to have you on.
Thank you everybody and havea good rest of your day.
Bye.

Chris Eidhof (guest) (41:58):
Hi.
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.