Jan Schwarz2 min

Swiftly Highlights: Apple Event Eve

EngineeringSep 1, 2022

Engineering

/

Sep 1, 2022

Jan SchwarziOS Engineering Director

Share this article

Welcome to the August episode of Swiftly Highlights, the monthly selection of the latest and greatest news from the development community for Apple platforms. But first things first: the big day is almost here!

Every summer, we impatiently await the announcement of when Apple will hold the special event where it announces its new operating system versions and devices. This year’s event will take place on September 7th — so save the date, get some popcorn, sit back and be amazed.

Now, let’s dive into the most interesting articles and blog posts from the last month.

UI

At STRV, we take accessibility seriously. An important step in making your app accessible is supporting dynamic types. With that, your app must account for the fact that any content can grow. At the same time, some UI components simply aren’t designed to be bigger than intended, like the navigation bar or tab bar. Here, the large content viewer comes to help, and luckily, you can even implement the large content viewer in SwiftUI.

The new iOS 16 hasn’t been officially released yet but once it is, it will be much easier to add the native photo picker to your app. Right now, if you need to present a photo picker in SwiftUI, you have to wrap PHPickerViewController in UIViewControllerRepresentable. Well, this will change soon.

Continuing with “stuff we’ll be able to use soon”... you’ve probably used GeometryReader many times, and it has most certainly broken your layout at some point. To save you from that, the new ViewThatFits was introduced — so don’t forget to check what it’s good for and how you can use it.

You’ve likely noticed the new Grid view and might be wondering why Apple took the time to work on this since we already had the LazyVGrid and LazyHGrid. There are actually multiple differences not only in the way the grids are composed but also in their laziness vs. eagerness. Take some time to check out the comparison.

Now back to the roots. ViewBuilders have been with us since SwiftUI was released. Their introduction was accompanied by some controversies but, regardless of what you think of them, if you use the @ViewBuilder attribute just to make your life easier and don’t really know what happens under the hood, you should read @ViewBuilder usage explained with code examples.

Beyond UI

Although this topic goes beyond UI, it is still very much connected to UI. For SwiftUI to efficiently re-render its views, it is backed by a powerful and optimized algorithm that recognizes the right time to do so. If you want to learn more, here’s some insight into SwiftUI diffing algorithm.

Is asynchronicity, thread safety and Swift Concurrency your cup of tea? Or would you like it to be? The Sendable protocol addresses exactly these topics and was already introduced in Swift 5.5, so don’t wait and go through the explanation and some code examples. Tip: You can also find links to more basic topics from Swift Concurrency in the article.

In case you ever come across a “0x8badf00d (“ate bad food”)” termination reason in your crash reports, remember that iOS has something called Main Thread Watchdog, a system tool for terminating unresponsive apps. It basically means that your app blocked the main thread for too long time; you can check out these tips and tricks to find out what actually caused it.

And Finally…

Allegedly, Apple applied for “Reality One,” “Reality Pro” and multiple other reality-prefixed trademarks. Is there some big announcement approaching?

That’s it for this month. Hope you enjoyed it and see you soon!

Share this article