There are so many cool new features in Swift and Xcode 🤩

Hi 👋

Before we go into the (very exciting) topic of all the cool new WWDC announcements, I want to share that my training course about iOS interviews is available with a 40% discount during WWDC week 😌


What a Keynote!

If Vision Pro holds true to its promise, we might be on the verge of some really exciting times, the likes of which we haven’t really seen since the release of the original iPhone more than 15 years ago 🤩

But I’m sure you’ve already heard all there is to know about what was announced during the Keynote. So I won’t be talking about it.

Instead, I installed Xcode 15 as soon as it was possible, and then I went exploring to look for all the cool new features I could find!

And now I want to share my findings with you 😌


Let’s start with this simple-yet-useful feature: when using conditional compilation, code that doesn’t match the current destination will be automatically grayed out by Xcode.


Another pretty cool quality of life improvement is the addition of code bookmarks.

If, like me, you used to set disabled breakpoints to keep track of specific places in your code, this workaround will soon be a thing of the past 👌


Xcode 15 also brings first-party support for a very useful feature: creating type-safe identifiers for resources stored in an AssetCatalog.

I’m sure a lot of you are currently using SwiftGen for this exact purpose.

This third-party tool might loose in popularity over the coming months, because from what I understand this new feature is even backwards compatible with older versions of iOS!


Previews have also been improved a lot!

First, the code to generate a preview is now much simpler, thanks to the use of the new Swift Macro #Preview.

But even better: previews now also work with UIKit and AppKit!


Swift 5.9 has brought a simple new feature that I’m particularly a fan of: if and switch can now be used as expressions!


Finally, there’s one last addition that gets me very excited: the support of Swift Macros.

I haven’t yet had the chance to experiment with macros a lot (at some point, you have to get some sleep 🤪) but I’m very excited about all the possibilities they will bring!

In a nutshell, macros are small Swift programs called at compile time that are capable of generating new source code.

You can think of them as basically offering the same possibilities than Sourcery, but this time built-in directly into the language.

Apple shared a few examples of using macros, like the one above where the macro @CaseDetection automatically generate properties to test whether a value corresponds to a given case 👌

I think it’s safe to say that you can expect me to talk a lot about macros during the coming weeks 😅

That’s all for this email, thanks for reading it!

If you’ve enjoyed it, feel free to forward it
to your friends and colleagues 🙌

I wish you an amazing week!

❤️

Previous
Previous

Here are 5 great articles to keep up with WWDC 😌

Next
Next

How would you answer this typical iOS interview question? 🤨