iOS Newsletter
Hey hey,
We’ve got a mixture of topics this week — from using the new Translation
API all the way to the basics of downloading a file off the net. We hope you like it, and if you do — tell your friends about it. 🙂
Enjoy!
Swift
Using Binaries as Libraries
Libraries are the standard way to integrate third-party features with your codebase. It’s not necessarily the only way, though. In some scenarios (CI, for example), you may benefit from spinning an external binary from your codebase, performing some work with it, and getting a response back. In that case, Process
and Pipe
are your friends, as this article explains.
Morphology in Swift
Pluralization is one of the things that can be a source of headaches for your app if not done right. Not only that, but it may make your app feel amateurish to the end users. This article takes an edge case to describe the existence of morphology in Swift. It’s so satisfying to witness such attention to detail.
UI/UX
Preview SwiftUI Views with Bindings Using @Previewable
The @Preview
macro is slowly replacing the PreviewProvider
protocol for good. The macro allows us to gain some features in our previews that weren’t possible or easy before. One such new feature is the more ergonomic support for bindings — here’s how.
Downloading Files from URLs in Swift [SwiftUI Architecture]
File downloading is a trivial process, they say. We know, however, that this statement is not necessarily true. Yes, we have everything needed to do the job in URLSession
and URLSessionDownloadTask
, but it’s always how we use these what matters. This article takes an in-depth look at the UX of downloading some relatively large files for a podcast app, and integrating that with the app’s UI. Highly recommended read.
Using the Translation API in Swift and SwiftUI
Translation
is one of the new APIs (from iOS 17.4) that Apple ships to us to integrate. We don’t think we have to highlight the benefit this may have for some end users. This article explains how to get started with adopting the Translation
APIs in your app.
Tips
Unified Views for Stack Traces in Xcode 16
As Vincent Pradeilles noticed, Xcode 16 now comes with a unified view of the stack trace when debugging, with all the code snippets involved available in the same place. It’s a quite welcome improvement as we no longer have to jump from file to file. Check the video he has attached to his tweet.
Tools
swift-concurrency-primitives
This repository caught our attention this week as it ships some missing primitives that may be quite useful when working with Swift Concurrency — Lock
, Locked
, which is similar to Mutex
in other languages, ThreadPool
, Channel
, and Queue
. Even if you don’t end up using the package, studying the implementation of these primitives can be quite beneficial.
Talk
A Practical Guide to Swift Performance
John Sundell gave a talk on optimizing our apps for performance at Swift Connection 2024. As performance is something all of us care about, this talk gave us a few new angles and approaches to leverage next time we audit our apps.