Snapp Mobile iOS Newsletter

Issue 8 • September 20, 2024

It’s THE “new iPhone”-day today!

Before you head to YouTube to watch people smashing their shiny iPhones, iPads and watches - here’s a collection of Swift 6 and iOS 18-related pieces that we think you’re gonna love.

With Swift 6 already here and Apple Intelligence in the pipeline there will be exciting times ahead both on the hardware and the software side of things!

Swift

Announcing Swift 6

Swift 6 is finally here! This is a major new release that expands Swift to more platforms and domains. As the Swift language group states:

“Many people know of Swift as a language for app development, with a million apps on the App Store. But Swift is great for more than just apps. Swift’s safety, speed, and approachability make it a great choice for many other use cases including libraries, internet-scale services, and the most performance-critical and secure code.

Swift 6 scales even further through new low-level programming features, an embedded Swift language subset, expanded Linux and Windows support, new cross-platform APIs including the new Swift Testing library, and more.”

Deprecations in iOS/iPadOS 18

Swift 6 is just a part of what Apple brought to the market this year as it got anounced along with the new versions of iOS and iPadOS. However some pieces that have been around for a while have faced deprecations. This article captures the most significant ones and it’s certainly bookmark-worthy.

Swift Noncopyable Type and Variable Ownerships

Noncopyable types are a relatively new Swift feature (introduced in Swift 5.9). Values of noncopyable type always have unique ownership, and can never be copied (at least, not using Swift’s implicit copy mechanism). This article explains why and where you may find it helpful.

Thread safety with Mutex in Swift 6

With Xcode 16 / Swift 6, Apple introduced the Synchronization framework, bringing to the table more ways to ensure thread safety in our software.

Here’s a quick exploration of the Mutex struct, checking on how it can be used to prevent crashes and undefined behaviour due to simultaneous reads & writes to shared mutable data. There’s also a discussion on how a similar type can be implemented to support older iOS versions.

CI

Using Swift Macros in CI/CD Without Compromising Security

Swift Macros are great addition to the language, but integrating any third-party macro in your projects requires confirmation in Xcode that you trust and enable it. This may lead to problems when the project is built on a CI machine as the build will fail if this step is skipped. Read on to discover how you can solve this in an elegant way.

UI

What’s new in SwiftUI for iOS 18

Paul Hudson had aggregated a lot (and we mean a lot) of articles in a great overview of what’s new in SwiftUI for iOS 18. From custom text effects and animations to using @State in previews with @Previewable, to smaller improvements - this entry page leads to a plethora of articles covering quite a serious amount of information.

Testing

Using Traits to annotate and customize test behavior

Antoine van der Lee has been busy writing another article, this time on how to use traits with the SwiftTesting framework that just got released along with Swift 6. Traits allow you to configure common behaviors, like runtime evaluated conditions, to skip certain tests.

WWDC

Migrate your app to Swift 6

This talk from WWDC 2024 goes through updating an existing app to Swift 6 incrementally. It’s a lot to grasp at once but revisiting it once in a while is proven to be extremely helpful to us.