iOS Newsletter
Hi folks,
Apple has put up release candidates for iOS 18.4 and Xcode 16.3 before releasing them to public sometime next week. We’re looking forward to some of the much needed Xcode improvements - on-device debugging on older OSes (iOS 15+, watchOS 7+), predictive code completion improvements and fixes, the new Processor Trace instrument, C/C++ interop enhancements, and the improvements around the Testing
framework (filtering by tags sounds particularly useful).
Along with that Apple has also announced the dates for this year’s WWDC event (June 9-13). The rumor mill on a big visionOS-like redesign on iOS is now at full speed, so it’s always interesting how much of the rumors will turn out to be true in June.
Newsletter-wise, this week we’re looking at some Swift language features, sorting a problem with using Macros on the CI, and we continue the explorations around the MCP by featuring an article on how to build our own MCP server in Swift.
Enjoy!
Swift
Advanced Swift: Defer
The defer
keyword in Swift allows you to specify code that should run at the end of the current scope, right before control leaves the block. This is especially helpful for managing resources like files, network connections, or locks. Here’s how we can start using it in our apps.
Awaiting multiple async tasks in Swift
If spinning off a task group feels like too much for a few small asynchronous tasks, Swift has an alternative in the shape of the async let
syntax. Read on to discover (or refresh your memory) on how to utilize it
Simple Modularization setup for a New App
Modularization can be great for large-scale apps as it results in improved build times, better separation of concerns, enhanced testability, easier collaboration and code reusability. This article looks at one of the ways to achieve that - by harnessing the Swift Package Manager and [fastlane](https://fastlane.tools)
.
UI/UX
Building Flexible, Styled ListItems in SwiftUI
List items are probably one of the most used design elements in any app. In this post, the author walks us through how he creates list items that are easy to use and flexible when needed, how to define different types of list items, and how to handle “slot” items.
CI
DX: Only run unit tests for changed modules
Related to the article on modularizing our apps, in fact from the same author, here’s an article on a easy developer experience win: Only run the unit tests for the modules with changes against a base branch. This will also save precious CI time, as developers will get test failures on their machines, without the need to wait for the CI to run all the tests. The article uses links to a PR for creating a custom lane for achieving this, so it ticks all the boxes.
Solving Swift Macro Trust Issues in Xcode Cloud Builds
Swift macros are powerful but can break your CI pipeline with trust errors. Learn how to implement a simple post-clone script to solve the “Target must be enabled” error in Xcode Cloud (or any other CI, really) once and for all.
Productivity
Building a MCP server in Swift
We have written about MCP in issue #31. Very simply, MCP servers provide prompts, resources, and tools. Clients connect to servers and discover what’s provided, and then surface those to the LLM and/or user as they see fit. The easiest way to think of an MCP server is a bag of functions – servers list the functions (tools) to the client, and the client calls those functions with some input. This article walks us through one of the many ways to build such a service - by using Swift.
Using Cursor with Xcode and Android Studio
As AI and LLMs are getting more and more utilized in our development workflows, we can fill in the gaps of integrating them with our daily drivers. This article walks us through setting up a keyboard shortcut that switches from Xcode and Android Studio to the same file in Cursor — and back again. Neat!