How Enterprise level CI/CD with AppCircle helps you scale

Published on: April 25, 2024

As teams grow and companies mature you’ll often find that it gets harder and harder to manage processes that seemed to be so simple before. When I worked in startups one of my favorite things was how quick the feedback cycle was on pretty much everything I did. When someone designed a new feature we could build that and ship it on Testflight as quick as a couple of hours. If the designer liked the way the implemented feature works they would sign off and off to App Review we’d go. Usually everybody in the company would be on the...

Read more...

What are lazy vars in Swift?

Published on: April 23, 2024

Sometimes when you’re programming you have some properties that are pretty expensive to compute so you want to make sure that you don’t perform any work that you don’t absolutely must perform. For example, you might have the following two criteria for your property: The property should be computed once The property should be computed only when I need it If these two criteria sound like what you’re looking for, then lazy vars are for you. A lazy variable is defined as follows: class ExamResultsAnalyser { let allResults: [ExamResult] lazy var averageGrade: Float = { return allResults.reduce(0.0, { total, result...

Read more...

Deciding between a for loop or forEach in swift

Published on: April 23, 2024

Swift offers multiple ways to iterate over a collection of items. In this post we’ll compare a normal for loop to calling forEach on a collection. Both for x in collection and collection.forEach { x in } allow you to iterate over elements in a collection called collection. But what are their differences? Does one outperform the other? Is one better than the other? We’ll find out in this post. Using a regular for loop I’ve written about for loops in Swift before so if you want an in-depth look, take a look at this post. A regular for loop...

Read more...

Dispatching to the Main thread with MainActor in Swift

Published on: April 23, 2024

Swift 5.5 introduced loads of new concurrency related features. One of these features is the MainActor annotation that we can apply to classes, functions, and properties. In this post you’ll learn several techniques that you can use to dispatch your code to the main thread from within Swift Concurrency’s tasks or by applying the main actor annotation. If you’d like to take a deep dive into learning how you can figure out whether your code runs on the main actor I highly recommend reading this post which explores Swift Concurrency’s isolation features. Alternatively, if you’re interested in a deep dive...

Read more...

How to use experimental Swift versions and features in Xcode?

Published on: April 18, 2024

If you’re keen on reading about what’s new in Swift or learn about all the cool things that are coming up, you’re probably following several folks in the iOS community that keep track and tell you about all the new things. But what if you read about an upcoming Swift feature that you’d like to try out? Do you have to wait for it to become available in a new Xcode release? Sometimes the answer is Yes, you’ll have to wait. But more often than not a Swift evolution proposal will have a header that looks a bit like this:...

Read more...

Actor reentrancy in Swift explained

Published on: April 11, 2024

When you start learning about actors in Swift, you’ll find that explanations will always contain something along the lines of “Actors protect shared mutable state by making sure the actor only does one thing at a time”. As a single sentence summary of actors, this is great but it misses an important nuance. While it’s true that actors do only one thing at a time, they don’t always execute function calls atomically. In this post, we’ll explore the following: Exploring what actor reentrancy is Understanding why async functions in actors can be problematic Generally speaking, you’ll use actors for objects...

Read more...

Building a backend-driven paywall with RevenueCat

Published on: April 4, 2024

On of app development’s largest downsides (in my opinion) is that it’s frustratingly hard for developers to quickly iterate on an app’s core features due to the App Review process which can take anywhere between a few hours to a few days. As a result of this process, developers either need to ship their apps with A/B testing built in if they want to test multiple variations of a feature, they can iterate more slowly or they can opt to build a so-called backend-driven UI. A backend-driven UI is a user interface that’s drawn by fetching information about the UI...

Read more...

Using closures for dependencies instead of protocols

Published on: April 2, 2024

It’s common for developers to leverage protocols as a means to model and abstract dependencies. Usually this works perfectly well and there’s really no reason to try and pretend that there’s any issue with this approach that warrants an immediate switch to something else. However, protocols are not the only way that we can model dependencies. Often, you’ll have a protocol that holds a handful of methods and properties that dependents might need to access. Sometimes, your protocol is injected into multiple dependents and they don’t all need access to all properties that you’ve added to your protocol. Also, when...

Read more...

Building an AsyncSequence with AsyncStream.makeStream

Published on: March 25, 2024

A while ago I’ve published a post that explains how you can use AsyncStream to build your own asynchronous sequences in Swift Concurrency. Since writing that post, a new approach to creating AsyncStream objects has been introduced to allow for more convenience stream building. In this post, I’ll expand on what we’ve already covered in the previous post so that we don’t have to go over everything from scratch. By the end of this post you will understand the new and more convenient makeStream method that was added to AsyncStream. You’ll learn how and when it makes sense to build...

Read more...

How to make sure your CI pipelines are always up to date?

Published on: March 12, 2024

When you work with CI, you’ll know how frustrating it can be when a CI server has versions of Xcode or other tools installed than the tools that you’re using. Especially major Xcode releases can be problematic. If your CI doesn’t have the same new versions available while your project uses recently released features which will lead your builds to fail. An obvious example of this would be when you start using features that are exclusive to the latest iOS version. If Xcode doesn’t know about these features then your project won’t build. An out of date CI can cause...

Read more...