import Image from '@components/Image.astro' Over the past few months, I have shifted most of the time I spend building features to Cursor when working on client projects, and only really switch back to Xcode when I am doing the last bits of polishing and writing code myself. While this workflow has been making me more productive, I have always enjoyed Xcode as an editor and was really excited to…
As of Xcode 26, the Metal toolchain is no longer included in Xcode's installation by default . This means that, if your app or one of your dependencies needs to use the toolchain, you will need to install it manually before building your app. When running your app locally using Xcode, this issue manifests itself as a build error: The fix is simple enough and, as the error message says, you just…
Debugging is a skill that is often overlooked by developers. It is a skill that is not only useful for fixing bugs, but also for improving your understanding of the codebase and the language you build software in. Especially as we enter the era of AI-assisted debugging , where more often than not, we find ourselves trying to understand the code an LLM has given us or, what's worse, the bugs it has…
Swift is a powerful language that provides a bunch of built-in quality-of-life features that help developers write clean, efficient and readable code. The language keeps evolving with each new release and there are always new features to explore and learn about. One such feature that only recently caught my attention is the ListFormatter class. If you have ever worked with lists in Swift and had…
Menu bar items are a great way to provide quick access to your macOS app's features. In fact, there are many apps that rely solely on a menu bar item to provide all or most of their app's functionality. A common pattern in macOS apps is to provide different functionality or appearance based on whether the user clicked on the item with a modifier key pressed or not. Commonly, apps check if the…
Swift's Observation framework provides a powerful set of APIs that allow developers to implement type-safe observation of properties in objects of their choice with very little code. The core part of the framework is the @Observable macro, which when applied to a class, it makes all of its properties observable unless marked otherwise with the @ObservationIgnored macro. This pattern is commonly…
One of the features that Hidde and I have wanted to bring into Helm since its early days is the ability to have a menu bar item that allows users to quickly glance at their apps' status and open them with a single click. To make the menu bar item as useful as possible for the user, we also wanted it to still be visible in the menu bar even after the user has quit the app itself. This is a pattern…
Up until very recently, my app QReate was available in the App Store as a paid app. Users would pay a one-time fee of $4.99 to download the app and use all of its features at no extra cost. This business model worked well for me for a long time, but, after Hidde 's recommendation, I decided to change the app to be free to download and then offer a one-time in-app purchases to unlock all of the…
import Image from '@components/Image.astro' import Video from '@components/Video.astro' With over 2 million apps available on the iOS App Store, competition is fierce and it has never been harder to penetrate the mobile app market and get users to download your app. Among the many factors that can influence a user's decision to download your app, the quality of your app store assets is one of the…
As a maintainer of the appstoreconnect-swift-sdk library, I often find myself keeping an eye on new releases of the App Store Connect API and then manually updating the library's code based using the new version's OpenAPI spec. As you can imagine, this process is not very scalable and relies heavily on manual input, which can lead to situations where the library misses updates of the API…
import Image from '@components/Image.astro' import Video from '@components/Video.astro' Code signing is a crucial part of the app development process as Apple requires any third-party code to be signed and authorized before it can run on device on any of its platforms. There are two key components to the code signing process: signing certificates and provisioning profiles . In this article, I will…
import Image from '@components/Image.astro' One of the most common errors that can happen when you upload a new build of your app to App Store Connect is that its version and build numbers are older than the ones that are already in the store. This can happen if you forget to update the MARKETING_VERSION and PROJECT_VERSION settings in your Xcode project before building and archiving your app.…
import Image from '@components/Image.astro' import Video from '@components/Video.astro' There are certain times when a version of your app has a bug or crash in production that majorly impacts most or all of users. Whenever these issues happen, it is important that you react in a timely manner to minimise the impact that the incident has for your users and to also prevent your app's rating from…
import Image from '@components/Image.astro' Fastlane is a popular Open-Source tool for automating the build, testing, and deployment of iOS and Android apps . It provides a set of tools that can be used to automate the most common tasks in the app development process. Fastlane has been a standard tool in the iOS development community for a long time as it comes with a set of pre-built actions and…
Before the introduction of @Observable in WWDC23, the only way to make a class' property observable to SwiftUI was to use the @Published property wrapper and make the class conform to the ObservableObject protocol. This approach would allow you to observe the class in SwiftUI using the @ObservedObject or StateObject property wrappers and any @Published property would cause the view to update when…
import Video from '@components/Video.astro' import Image from '@components/Image.astro' Core Data is a powerful framework that allows you to manage the persistent model layer of your application and, while it is a first-party solution that has been a standard in the Apple ecosystem for many years, it is dated and is not straightforward to use . In fact, the community has been asking for many years…
I have recently shipped a new version of my app QReate that includes a complete redesign of the Safari extension. The UI for the extension is built entirely using SwiftUI and, as I could not find many resources on how to build Safari extensions using SwiftUI online, I thought it would be a good idea to write a blog post about it. Creating a Safari Extension target The first step to building a…
In SwiftUI, it's common to display a list of items and allow users to navigate to a detail view when an item is selected. To show more information and enable editing in the detail view, you'll need to pass a binding of the selected item to the detail view. However, the common way of using ForEach loops, NavigationLink s and the .navigationDestination modifier is with the wrapped value of a binding…
I have recently been working on an app that allows users to save digital copies of football tickets for games that they have attended. To display the tickets for all the games the user has been to, I decided to create a UI similar to the Apple Wallet app , where the tickets are stacked on top of each other from new to old and each of them has a negative vertical offset to create a nice overlapping…
As a developer for Apple platforms, you probably work on multiple projects with different coding styles and conventions and have to find yourself adjusting Xcode's editor settings every time you switch between projects. This can be a tedious process that you might forget to do or overlook and, if the project does not have a linter that enforces the coding style, you might end up with inconsistent…
Swift is a mature and powerful language that can be used way beyond development for Apple platforms. Due to its low memory footprint, performance and safety features, it has become a popular choice for server-side development. One particular use case where Swift shines is in the development of Serverless applications using AWS Lambdas and, since I have been building and deploying them for many use…
Back in WWDC21 and with the launch of Xcode 13, Apple introduced a new xcodebuild option that generates a memory graph whenever a UI test measuring XCTMemoryMetrics fails. The flag is called enablePerformanceTestsDiagnostics , is only available in xcodebuild and not in Xcode and only generates memory graphs for failed UI tests when the tests run on a physical device and not on the simulator. While…
An XCResult bundle is a package or directory that contains detailed information about the results of running a set of tests. These bundles are generated by Xcode (or by xcodebuild in the command line) and provide a wealth of information about the tests that were run, including the test's name, duration, status, and any attachments generated by them such as screenshots or logs. In Xcode, you can…
A checksum is the result of applying an algorithm to a file's contents that is used to verify the file's integrity . It is a common practice to use checksums to ensure that files have not been tampered with or corrupted during transfers such as downloads or uploads. You will be familiar with checksums if you have ever distributed a binary artifact through CocoaPods for example. There are plenty of…
Recursive functions are functions that call themselves . They are a powerful tool in programming that's commonly used to solve complex problems simply and elegantly by breaking them down into smaller subproblems. These types of functions are often used in algorithms that can be naturally defined in terms of themselves , like traversing a tree or a graph, or when you need to perform the same…
As developers, when we release a new version of our app with new features and bug fixes, we want our users to update to the latest version as soon as possible. However, many users don't have automatic updates enabled on their devices , and if they don't open the App Store app and look for available updates, they might never know that a new version of your app is available. This is why it's a good…
SwiftUI has a powerful API that allows you to insert a side panel view that shows alongside the view it's attached to called inspector . The API is available through the inspector view modifier that takes a binding to a boolean that controls the visibility of the inspector and a closure that returns the view that should be shown in the inspector. This is a pattern that is widely used in the Apple…
During WWDC24, Apple announced Translation , a new first-party framework built using CoreML models that allows you to perform on-device translations in your Swift apps entirely for free. Up until now, developers had to rely on third-party services such as the Google Translate API or Open AI to dynamically translate text across different languages in their apps. While these services are very simple…
Swift Testing is a modern, expressive and macro-based testing library introduced by Apple during WWDC 24 as a more modern alternative to replace XCTest when writing unit tests. I personally love this new way of writing tests and I think it will make testing in Swift much more enjoyable and expressive. In this article, I will show you how to get started with Swift Testing, how to write tests using…
Up until WWDC 24 , SwiftUI had no built-in way of creating floating windows or, in other words, windows that stay on top of everything on the user's screen. This was a limitation that I faced when building QReate's latest feature and that I had to rely on AppKit to implement: During the What's new in SwiftUI session, Apple introduced a new set of APIs for window management that, among other…
We recently fixed a bug in our app Helm which occurred when trying to set the time of a scheduled release using the App Store Connect API. The date we were sending in the request contained the day, month, year, hour and minute , but the API would only allow us to be precise up to the hour . To fix the issue as quickly as possible and as SwiftUI's DatePicker can not be configured to only allow the…
We have recently added the ability to manage your app's phased releases in Helm . The feature allows you to see the progress of the 7-day rollout of your app's new version as well as pausing or resuming the roll-out and even releasing the version to all users at any time. As part of this work, we built a custom segmented circular progress view using Swift Charts that we would like to share with…
I have recently learned that some of the breaking changes that will come with Swift 6 (like full data isolation and data race safety checks) will be part of the Swift 6 language mode, which will be an opt-in feature in the Swift 6 compiler . This means that, when you update your version of Xcode or use a Swift toolchain that uses the Swift 6 compiler, unless you explicitly enable the Swift 6…
Profiling your application and identifying areas where you can optimize your app's performance is crucial to ensure a smooth experience for your users . As an Apple developer, it is crucial that you are familiar with the tools that Apple provides to perform these tasks. Instruments is an app that is part of Xcode's suite of tools that allows developers to profile their apps for things such as…
This week I came across a situation where I had to pass the member of an optional struct held as a @State property to a child view as a Binding . Sounds simple, right? Well, the problem was that the child view, which I did not have control over, was expecting a Binding with a non-optional value: import SwiftUI struct Version: Identifiable { let id: String var name: String } @Observable final class…
I have recently been working on a brand new screen for Hidde and my app Helm that allows you to see all builds available on TestFlight and lets you add them to beta testing groups. As part of this work, I needed to create a component that allows users to add and remove beta groups from a specific build . I wanted to build something similar to the picker component in App Store Connect to make the…
The SE-0409 proposal introduced the ability to mark import declarations with any of Swift's available access levels to limit the types or interfaces that imported symbols can be used in. Thanks to these changes, dependencies can now be marked as being visible to the current source file ( private or fileprivate ), module ( internal ), package ( package ), or all clients ( public ). This proposal…
I have recently joined a new team at work and I am still getting to know the team's domain and what parts of the codebase we own. Thankfully, our repository has a GitHub CODEOWNERS file and, every file or group of files that we own is reflected there. If you're not familiar with the concept or format of GitHub's code ownership model, it allows you to link one or more files using Glob patterns to…
Swift's Sequence type has a powerful operator called reduce which allows you to combine all elements of a sequence into a single value. I have been using it over and over again when dealing with responses from the App Store Connect API and I thought it would be a good idea to write a blog post about it. The reduce operator has two different signatures: // Reduce with an initial result @inlinable…
I have recently been working on a new Swift Package library that supports iOS, macOS and Linux. As I wanted the development lifecycle to be fast and iterative , I decided to make the library's release process as automated and as error-proof as possible . I came up with a GitHub Actions workflow that runs every time a new tag is pushed to the repository and performs the following steps: Build the…
Apple has recently introduced over 50 new analytics reports with hundreds of new data points and metrics to help developers understand how their apps are performing . These reports include data such as App Store Engagement, App Store Commerce, App Usage, Frameworks Usage and Performance. While this new data offers a lot of insights and can be very valuable, it's available exclusively through the…
A few weeks ago, I wrote an article where I explained how to perform complex Core Data migrations using mapping models and custom migration policies . While that approach is performant and works well, it can be hard to maintain, it does not scale with your application and is highly error-prone. For example, for every new model that you define that requires a custom migration, you need to define a…
Pkl (pronounced Pickle) is a new programming language from Apple designed specifically for configuration. It allows developers to design data models safely and expressively through the use of types and built-in validation. A feature that sets it apart for Apple developers and, as it couldn't be any other way with Pkl being an Apple language, is that it has a suite of tools available for generating…
One of my main goals in the last few weeks at work has been to find and fix as many memory leaks as I can in our iOS app . After fixing each memory leak and to ensure it would not come back again, I decided to write a unit test to track the lifecycle of the leaked instance/s. As some of the leaks occurred in methods across different modules in our app and different repositories in our…
It is natural for your app to evolve. As your app and your user base grow, you will need to add new features, remove other ones and change the way your app works. This is a natural consequence of the software development lifecycle that we should embrace. And as your app evolves, so does your data model. You will need to change the way your data is structured to accommodate new features while…
I recently decided to spend some time automating the release process for NowPlaying and make shipping new versions of the app as simple as possible . I decided to use Xcode Cloud as our CI/CD solution due to its tight integration with Xcode and App Store Connect and the fact that, as we have an Apple Developer Membership, we would get a tier of 25 compute hours per month at no extra cost ! At the…
I have recently worked on a feature for NowPlaying that leverages iOS's SharePlay APIs to allow users to join listening sessions and discover new music with their friends. I struggled a lot to get things working originally and found Apple's documentation to configure SharePlay sessions sparse and a bit confusing. For this reason, I decided to write a comprehensive guide on how to configure a…
I usually write about Swift and mobile app development but, as I have been working on an interesting and challenging project this week that is outside my comfort zone, I thought I would share it with you and write about it regardless. Hidde and I have launched a new feature this week to NowPlaying's website that allows users to share any song via a single link from the app so that anyone they…
A couple of weeks ago, I wrote an article about how to load Stable Diffusion models in Swift and generate images from text prompts . In this article, I want to expand on that and show you a new feature I have been working on for my QReate : AI-generated QR codes . The feature works by passing an image of a QR code to a Stable Diffusion image-to-image pipeline , which takes a prompt from the user…
I've been a software developer building iOS applications for the past 6 years and in that amount of time, I have seen numerous changes to the industry and the responsibilities of my role . I have seen new architecture patterns and trends come and go, new frameworks and languages emerge and old ones phase-out and, especially at the beginning of my career but still to this day, I do at times feel…