Learn more about Swift

What is type erasure in Swift? An explanation with code samples

Updated on: January 7, 2025

Swift’s type system is (mostly) fantastic. Its tight constraints and flexible generics allow developers to express complicated concepts in an extremely safe manner because the Swift compiler will detect and flag any inconsistencies within the types in your program. While this is great most of the time, there are times where Swift’s strict typing gets […]

Read post

Creating type-safe identifiers for your Codable models

Updated on: April 5, 2021

Note: After publishing this article, it has been brought to my attention that the folks from @pointfreeco have a very similar solution for the problems I outline in this post. It’s called tagged and implements the same features I cover in this post with several useful extensions. If you like this post and plan to […]

Read post

Why your @Atomic property wrapper doesn’t work for collection types

Published on: April 20, 2020

A while ago I implemented my first property wrapper in a code base I work on. I implemented an @Atomic property wrapper to make access to certain properties thread-safe by synchronizing read and write access to these properties using a dispatch queue. There are a ton of examples on the web that explain these property […]

Read post

An introduction to Big O in Swift

Published on: April 13, 2020

Big O notation. It’s a topic that a lot of us have heard about, but most of us don’t intuitively know or understand what it is. If you’re reading this, you’re probably a Swift developer. You might even be a pretty good developer already, or maybe you’re just starting out and Big O was one […]

Read post

Enforcing code consistency with SwiftLint

Published on: March 30, 2020

If you’re ever amongst a group of developers and want to spark some intense discussion, all you need to do is call out that tabs are better than spaces. Or that indenting code with two spaces is much better than four. Or that the curly bracket after a function definition goes on the next line […]

Read post

What is @escaping in Swift?

Updated on: January 20, 2025

If you’ve ever written or used a function that accepts a closure as one of its arguments, it’s likely that you’ve encountered the @escaping keyword. When a closure is marked as escaping in Swift, it means that the closure will outlive, or leave the scope that you’ve passed it to. Let’s look at an example […]

Read post

Using Result in Swift 5

Published on: March 2, 2020

As soon as Swift was introduced, people were adding their own extensions and patterns to the language. One of the more common patterns was the usage of a Result object. This object took on a shape similar to Swift’s Optional, and it was used to express a return type that could either be a success […]

Read post

Error handling in Swift with do catch

Updated on: July 4, 2025

Handling errors in Swift is done using a mechanism where functions specify their ability to throw errors. In modern Swift versions (6.0 and up), functions can even specify the type of the error that the function might throw. When we call a function that can throw, we use special syntax to either ignore the error […]

Read post

Expand your learning with my books

Practical Swift Concurrency header image

Learn everything you need to know about Swift Concurrency and how you can use it in your projects with Practical Swift Concurrency. It contains:

  • Eleven chapters worth of content.
  • Sample projects that use the code shown in the chapters.
  • Free updates for future iOS versions.

The book is available as a digital download for just $39.99!

Learn more