Read the transcript
Jeroen Leenarts: Hi, and welcome
to the 52nd episode of my
podcast. My name is Leenarts and
I've been developing software
for over 90 years developing iOS
apps for over nine years and I'm
running the Dutch cocoa has for
over eight years. If you're an
iOS app developer, you should
listen to my podcast because it
will keep you updated on
interesting articles and events
you might have might not have
heard about. In this episode,
I'm going to talk about down on
progress with awaited network
tasks. What is keep off in Swift
unit testing weak references
retain cycles in Swift, how to
launch app not immediately but
launch after waiting about
phantom types. iOS architecture
at lifts working with tap view
in Swift UI, mastering control
group in Swift UI presentation
tips for performance
professional swift talks
sandable. And at Sandwell
closures explained with code
examples. Also, I will mention
done each Monday morning tweet.
So let's get started. Last week,
I went on a family vacation. So
I prepared some episodes for
last week. And I also promised
in that episode to double up on
the content this week. So I have
10 links that I want to share
with you today. All in all, I
think it's it's going to be a
big change next week. And I
really look forward to this new
step in my career, which in part
has been made possible by me
podcasting defecation that my
family and I went on was was
great. My my two children, they
really enjoyed themselves by
swimming and playing a lot. And
there was this play center that
really enjoyed. And my wife and
I, we played a lot of board
games, while the kids were
having a lot of fun. So that was
good. If the kids are happy,
then usually the parents are
happy as well. And that was
certainly true. In our case, on
the mechanical keyboards, I made
a big decision for my self at
least, I'm going to go with a
Kimiko PCB once it's available
again. And the reason I'm doing
that is because it's a German
person who made his own
derivative design based on two
designs for PCBs that I really
like. But he did an upgrades and
improvements on these two PCBs.
And I really like to stack it.
And so I finally made my choice.
And now it's just waiting for
the item to be back in stock.
Again, still undecided on what
exact switch I'm going to use.
But I won't bother you too much
with those details. At tomorrow,
I'm going to go on a team outing
with my current job is going to
be in part my goodbye party as
well at work. So we're going to
go go karting. And I'll let you
guys know how I did probably,
I'm just happy if I don't crash
into a wall really, so not much
else to to mention on the
personal areas. So I'll just
dive in right now with the
content of this week. The first
article is by Suresh Kambou. I'm
really happy that he published
another article again, because
every time that he publishes
something, I'm really happy
about it. And he has a good
writing form, and good thoughts
on many things. His article is
called download progress with
await network task. So it's an
article in the async await area.
And Suroosh wrote about how
async await might look and swift
five years ago. So he's in
hindsight, looking back a bit on
his earlier post and seeing how
things turned out. And if if
it's something that he enjoys
using for asynchronous
programming with URL session and
networking tasks. And what's
really interesting about the
approach that Suroosh takes is
that it's very easy to monitor
progress of your downloads while
you're doing them. So definitely
have a look at this article.
Because there's some good things
in there that might teach you a
trick or two, that you can use
your next bit of Euro session
coding. The next article is by
soon what is the key path in
Swift key path is a type that
represents a reference to
properties. At some level, it is
a kind of meta programming, it
might not be obvious how you can
fit this language feature into
your code. But by learning about
the key path, you open up
yourself to an opportunity to
improve your existing API or
even create a new one that you
didn't know you could create by
just knowing about key path, you
might not get it right right
away. But as you see more and
more use case, he might be able
to find an opportunity to use
key paths in the future. Any
article certain describes what
key paths in Swift are and how
you can use them and what role
they can play within your
coding. It's it's a bit of
syntax that I'm not seeing too
much in code online yet. But I
do think it's very worthwhile to
know more about the key path
syntax. So it's that so
backslash dots and then some
some variable. And what's really
interesting is there's some
details that you need to be
aware of when using key paths in
Swift. And I think siaran does a
nice job of giving an overview
and explaining what things you
need to take into account when
dealing with key paths. Also, he
describes what types of key
paths there are available. Yeah,
a lot of stuff to unpack in the
article bus rule. And I really
think it's one of those features
of the Swift language that's
very helpful to have in your
inventory to be able to use it
effectively. And I think
Sharon's article is a great way
to get started with this
language feature. The next
article is by Bruno unit testing
weak references and retain
cycles and Swift code that
relies on memory tricks to work
can be complicated. But there's
a solid way of unit testing
these cases. BRUNO sees people
wonder about this every once in
a while. So he thinks it's a
good moment to share the trick
that he is using to achieve
testing of weak references and
retain cycles. It's a nice
overview of doing unit testing
to exercise your code to see how
the memory behavior is. And you
can actually be surprised by
what kinds of things you can
find in your own
implementations. So I really
think that's the approach that
Bruno takes can be very
worthwhile, especially if you
have some bit of logic that is a
bit more involved a bit more
complex. And to just see whether
or not you're handling your
memory correctly. So maybe you
read this article, and you
think, okay, I could use this in
a specific unit test. Or if
that's the case, then I
challenge you to write this unit
test within the next 24 hours.
The next article is by Joey Kim.
It's a very short article. But
it's a nice reminder that you
can prevent Xcode from launching
your app immediately after
pressing or hitting the Run
button. So what this does, it's
it's only prepares Xcode to
attach the debugger wants to
correct process has been loaded
and started in memory of the
device. It's just a little
checkbox. So the article is not
much more than a paragraph in
the screenshot, but very
worthwhile to know that you can
wait for an executable to launch
to start your debugging session.
Now we move on to a new block
that I haven't seen before by
Julian Alonzo, the article is
about phantom types. So it's a
bit of an involved explanation
about what phantom types are.
But basically, it boils down
that you create a specific type
to rep, a basic type, to give
some semantics to the COL sites
of this specific bit of
information. For instance, the
example that is being used in
the article is around an access
token. So an access token can be
just a string, or if you use a
phantom type, you can actually
in all locations that you use
the access token, have to deal
with a struct called Access
Token benefit of this is that of
course, you can more easily find
the locations where you're using
an access token. And it can be
very helpful when you're dealing
with bigger code bases. So I
don't know how to describe this
article. But I liked the concept
that was being explained in it.
But I think overall, I've seen
this being used in the code that
I'm working on quite actively.
And it really is true that
having to search for a named
thing is much easier than just
trying to find all occurrences
of a string that happened to be
an access token in this example,
the next article is by Scott
Bader foods, it's about the iOS
architecture at Lyft. So in
2014, he joined Lyft, as the
first iOS hire on three person
team, and the app was written
and reactive C and architecture
had more than 5000, line nested
switch statements,
the team has grown since then to
70 people. And the code base is
now one and a half million lines
of code. So of course, having
this much code in an app
requires some changes along the
way, and also in a decent
architecture to be able to
manage these amounts of logic
within your application. What's
very fun about this is that
Scott lays out how they've done
it, they use modules, and they
use module types, and they have
a separation of codes along more
likely the types of code that
they're writing. And they're
also heavily involved in
dependency injection. What I
really like about article is
that it ties in with the same
line of thinking that I have
when working on my current code
base, which is heavily invested
with a tool called twist to
which really makes it easy to
create frameworks and to create
a structure of modules. Yeah, I
think that way of thinking is
it's absolutely necessary, once
your code base grows beyond a
certain size. And just being
aware about the fact that there
are things you can do to your
code. to structure it on a more
component level can be very
helpful if you ever have to deal
or actually are dealing with a
code base of this size. So onto
the next article. This article
is by Gabriel working with tap
view in Swift UI. It's really a
nice overview of how you can use
tap view in Swift UI, what the
details are, what things you
need to know and how you can
work with a tap view in your
code. So if you want to get
familiar with the taps view in
Swift UI, have a look at this
article because I think it's a
complete and concise overview of
the basics of dealing with a tap
view in Swift UI, Majeed wrote
an article on mastering control
group in Swift UI A control
group is not much else than a
grouping of controls. What this
allows you to do is group
together specific buttons and
attach titles and other metadata
to these buttons that are also
displayed on screen along with
your controls. grouping your
components together has a number
of benefits, it really shows
your user interface in a
hierarchical fashion that that's
really convenient for us to
understand what's going on. But
also you can influence your
components or your user
interface on a control group
level, the control group view is
a new way to group buttons and
other controls in a semantic
way. And I think grouping
controls in a semantic way is
something you already should be
doing if you want to retain some
measure of control of your user
interfaces. The next article I
want to mention is presentation
tips for performing professional
swift talks. It's a nice
overview of the process that
Aton from the lay uses when
preparing himself for a
presentation. It's based on his
experience, most recently on
Swift leads. And what he noticed
is that after being away from
giving presentations for such a
long time, due to COVID, he was
having some issues with getting
back into the flow of creating a
presentation again, knowing the
way Antoine likes to work, he
creates notes and then at the
end of his his endeavor, he has
his notes and on based on those
notes, he can create a nice
article. And this article is
very helpful because there's
some good tips in there on how
you can prepare yourself for
presentation all the way from
like the inception, to all the
way being onstage during the
talk. And then also what happens
after you've done the talk. He
does agree that performing the
talk is not easy and requires a
lot of preparation. Just like
with other things that you do.
You have to practice and learn
to get better. The article that
Antoine wrote is build up from
the experience at several
meetups and conferences and he
hopes that it will help you have
a better chance at giving a good
presentation.
And then the final article that
I want to mention is also by
Antoine formulae sendible and at
sandable closures explained with
code examples sandable and add
sandable are part of the
concurrency changes that arrived
in Swift 5.5 and address a
challenging problem of type
checking failures pass between
structured concurrency
constructs and actor messages.
That's a lot to take in in just
a few words. In his article on
Tom goes over when you should be
using sendible how you should
use sendible protocol and the
restrictions of conformance to
Sandwell in the same source
file. Finally, he mentions how
you should be using at sandable.
So the sendible protocol and add
sandable attribute functions
make it possible to tell the
compiler about thread safety
when working with concurrency in
Swift. Both features were
introduced to reach the big goal
of the Swift concurrency
efforts, which is providing a
mechanism to isolate states in
concurrent programs to eliminate
data races, the compiler will
help us in many cases with
implicit conformance to
sandable. But you can always add
performance yourself. It's a
really great overview of how we
can use the sendible and at
sendible attributes. And it's
one of those articles again by
Antoine that you shouldn't miss
and really take the time to take
in and read and learn about this
concept of sandable in Swift.
And that's the final article for
this week. So now onwards to the
Monday Morning tweet by Donnie.
There's a lot of stuff going on
in the small bit of the iOS
developer ecosystem that I'm
aware of. And yeah, it's just a
lot of people deploying and
releasing apps and preparing
themselves for a monetary
release later today. I'm
checking my update screen every
every 15 minutes today, even
though I know it will be
available only after seven in
the evening for me, but hey,
it's eight here. So it should be
arriving anytime now. So yeah,
since the the the messages the
replies on Danny's Monday
morning tweet are so universal
in what they're doing right now.
It's just yeah, there's not much
to detail to explain. But
there's one thing that I really
liked to see. And that's by peak
nap Ciak. Preparing to ship a
new update for the weather on
the way adding winds and gusts
along Route. So it's very fun
way you have routes and then you
can see along the way, what the
wind direction and wind forces
while you're traveling. Wouldn't
know what a why you want to use
this. But it's a really cool way
to add annotations to a map per
view. So yeah, that was really
nice. So and that's it for this
week. I'm a bit swamped with
work at the moment. So I wanted
to do quick recording. And
hopefully, next time I have some
more time. I was a lot of
content that I needed to get
through. But I do think that
yeah, we'll talk again next
week. And if you have any
feedback, just let me know. If
you want to support my podcast,
have a look at my Get Response
page or my poptop fan. slash
forest one page it allows you to
to contribute to me running this
podcast for a longer duration so
have a great week and talk to
you soon