Give your simulator superpowers

RocketSim: An Essential Developer Tool
as recommended by Apple

Typed throws in Swift explained with code examples

Typed throws are new since Xcode 16 and allow you to define the type of error a method throws. Instead of handling any error, you can handle exact cases and benefit from compiling time checks for newly added instances. They were introduced and designed in Swift Evolution proposal SE-413. I ...
Swift

Async await in Swift explained with code examples

Async await is part of the new structured concurrency changes that arrived in Swift 5.5 during WWDC 2021. Concurrency in Swift means allowing multiple pieces of code to run at the same time. This is a very simplified description, but it should give you an idea already how important concurrency ...
ConcurrencySwift

Swift Package Manager framework creation in Xcode

Swift Package Manager (SPM) is Apple's answer for managing dependencies. We're all familiar with tools like CocoaPods and Carthage, but we'll likely all use Swift Package Manager soon instead of those. If you're deciding which package manager to use, it's recommended to start using SPM today. By switching to the ...
Swift

ChatGPT for Swift: Top 5 code generation prompts

Using ChatGPT for Swift code generation can drastically increase your productivity. While I'm uncertain whether AI will take over our jobs as developers, I'm certain developers without knowledge of using AI to their advantage will become much slower in writing code. Today, we will look at a few of my ...
OptimizationSwift

Repository design pattern in Swift explained using code examples

The repository design pattern allows you to create an accessible data layer that's easy to mock for tests. By using common design patterns, you'll be able to create a consistent project structure, separate concerns, and increase the chances for the project to be easier to understand by outside contributors. One ...
Swift

Optionals in Swift explained: 5 things you should know

Optionals are in the core of Swift and have existed since the first version of Swift. An optional value allows us to write clean code while at the same time taking care of possible nil values. If you're new to Swift, you should get used to the syntax of adding ...
Swift

Extensions in Swift: How and when to use them

Extensions in Swift allow you to extend an existing class, struct, enumeration, or protocol with new functionality. Whether it's a custom type defined by you or a current type inside of a framework, extensions can create custom accessors and enhance the types you work with. So-called retroactive modeling allows you ...
Swift

Swift Evolution: Reading and learning from proposals

The Swift Programming Language constantly evolves, and most of its changes result from public proposals inside the Swift Evolution repository. The proposals can tell you what changes are coming up next, which is excellent if you want to stay updated with the latest developments. Swift Evolution Proposals can also help ...
Swift

User Defaults reading and writing in Swift

User Defaults are the go-to solution for Swift applications to store preferences that persist across launches of your app. It's a key-value store backed by a property list (plist) file. Due to this type of backing store, you need to be aware of the supported storage types. There are a ...
Swift

Thread dispatching and Actors: understanding execution

Actors ensure your code is executed on a specific thread, like the main or a background thread. They help you synchronize access to mutable states and prevent data races. However, developers commonly misunderstand how actors dispatch to threads in non-async contexts. It's an essential understanding to avoid unexpected crashes. Before ...
ConcurrencySwift

Value and Type parameter packs in Swift explained with examples

Type parameter packs and value parameter packs allow you to write a generic function that accepts an arbitrary number of arguments with distinct types. As a result of SE-393, SE-398, and SE-399, you can use this new feature from Swift 5.9. One of the most noticeable places of impact is ...
Swift