Subscribe for weekly commentary and coverage of Swift and Apple platform development. Written by Dave Verwer and published every Friday. Free.

Picture of Dave Verwer

Issue 616

30th June 2023

Written by Dave Verwer

Comment

Macros in Swift are this year’s big language feature. I’m sure you’ve already watched the excellent Write Swift macros and Expand on Swift macros WWDC session videos, but what comes after that?

We immediately put them in our production code and hope for the best, right? 😬

I wrote something similar when Swift 5.4 introduced result builders, and we saw a proliferation of experiments. Now we’re in that same period with macros.

The package index is already filling up with packages that contain macros, and it makes me glad we added 5.9 support so quickly. Some of the packages I’m linking to below will become essential parts of the Swift package ecosystem, and some will remain experiments. It’s impossible to know which yet!

There’s everything from full-featured packages like SwiftRequest and papyrus that let you define a type-safe HTTP client with function annotations to smaller utility packages like AssociatedObject, which allows variable storage in extensions. There are many, many more though. Here’s a list of others I saw this week:

There’s another advantage of having these packages available as open-source. They are educational resources, too! Are you curious about how you might want to use macros in your apps? Take a look through the source of some of the packages linked above. I’m sure you’ll learn something.

Dave Verwer

The #1 Chat API for Custom Messaging Apps

Stream’s Chat SDK helps you build beautiful chat applications with as little code as possible. With our SDKs, you can bring high-quality chat experiences to all of your end users. SDKs available for UIKit and SwiftUI. Try for Free Today. 30-Day Trial.

News

Supporting visionOS Compatibility Testing

I mentioned our adoption of 5.9 above, and we followed that up this week by rolling out another upgrade to the Swift Package Index compatibility build system. visionOS support! That takes our total tested platforms up to six! 🎲


Exploring the New Push Notifications Console

It was easy to miss amongst all the huge announcements at this year’s conference, but Apple’s new Push Notifications Console deserves your attention. Rizwan Ahmed has a nice overview of what it can help you with. What a handy tool!

Code

SwiftUI Index

Yes, Apple added API version diffing to the official documentation many years ago, but that doesn’t mean there isn’t value in alternative ways to get the information about what changes with every beta release. Kuba Suder has been working hard on this great, searchable visualisation of Apple’s documentation that you can view by topic or release.


containerRelativeFrame

Would you click this link if I said you were about to read 1,200 words on a single view modifier? How about if Jordan Morgan wrote those words? What if those words were way more interesting than I’m making them sound here? This view modifier is fascinating!


Trailing label TextField

Is this post from Magnus Jensen packed with the hottest exclusive iOS 17 information? No. Does it cover a well-designed solution to a problem you might also face? Yes. 🎉 I’d better link to it, then!


Embracing CloudKit

I’ve enjoyed Stuart Wheelwright’s journey through replacing his home-grown data sharing/syncing with CloudKit over the last few months. He wrapped up the 8-part series of posts a couple of weeks ago, and here they are! Thanks for sharing, Stuart! 👍

Design

New design resources now available

Get your updated design resources for iOS 17, macOS Sonoma, watchOS, tvOS, and … visionOS! Yes, if you were wondering how on earth to mock up screen designs for the headset, then Apple has Sketch and Figma design libraries ready to use.

It also includes a link to the brand new SF Symbols 5 beta, where you’ll find more than 700 additional glyphs, animated symbols, and more.


Redemption

I really love the way that Lukas Mathis thinks about this problem.

If your app has a streak feature, provide some way to recover from a streak loss after it has happened.

Jobs

iPad Software Engineer @ Liquid Instruments – Liquid Instruments is a startup creating a range of modern test and measurement devices using reconfigurable FPGA hardware. We’re looking for someone to help develop the beautiful iPad user interface that drives it all. – On-site (Australia)

And finally...

I said “but Craig uses it!” 💥