1 min read

Issue #25

Hi there,

Hope you had a wonderful WWDC week! I myself have been on vacation (and still am), and only checked out the keynote and saw some tweets from the community.

Other newsletters have featured lots of WWDC-related articles - for example I loved the latest iOS Dev Weekly which was 100% about WWDC.

I tend to forget all the new things by the time I can use them for real, so I'll be featuring more of the new APIs after Xcode 14 ships in September. My goal has always been to share things that can be used right away in real projects (gotta be honest it's also convenient because I could continue spending the vacation offline 😋)

I was also interviewed on the AppForce1 podcast, where I shared a bit about how I make the newsletter ☺️

Now let's dive in!


#unavailable attribute

The new #unavailable attribute has been added in Swift 5.6 (Xcode 13.3) - we can now check for older OS versions directly:

if #unavailable(iOS 15.0) { /* this code will run on iOS 14 and below */ }

Dealing with SwiftUI type inference

Do you sometimes try to write f.ex. Color.background, only to have nothing come up in autocomplete? The issue is that .background exists, just not on Color - it's a separate shape style, and the shorthand is only available by the magic of type inference. Jérôme here shares an approach for finding what you're looking for (see series of pictures in the full tweet)

Unit tests eh?

in all seriousness though:

The new thing is out

Eternal wisdom from Jordan, now more relevant than ever before:

Moving the cursor in terminal

Okay this is not a code thing per se, but this terminal key binding has been a nice time saver for me since I learned it a couple of years ago:

🤘☮️

Alright, that’s it for today.

Did you enjoy this issue? Let me know by pressing the buttons below, so I can improve the newsletter.

Got feedback? Want to see more, or less of certain kinds of tips? I’d love to hear from you. Reply to this email or reach out on Twitter via @ios_code_review 🙌