Equality
Let’s take a look at how Swift models the concept of equality, and how that concept varies between value and reference types.
Articles, podcasts and news about Swift development, by John Sundell.
Frequently published articles about Swift techniques, language features, architectual patterns, and beyond.
Subscribe via RSS
Let’s take a look at how Swift models the concept of equality, and how that concept varies between value and reference types.
A look at many different built-in ways to iterate over arrays, dictionaries, and other Swift collections.
Availability checks let us conditionally use new system APIs and features while still enabling the rest of our code to keep running on older system versions. Let’s take a look at how they can be used.
An introduction to Swift’s type inference system, how it makes the syntax of the language so lightweight, and how to work around some of its limitations.
In this Basics article, let’s take a look at a few examples of the various kinds of properties that Swift supports, and what their characteristics are.
Combine is a really powerful reactive programming framework from Apple, but getting started with it can be quite difficult, so let’s go through the basics of its API and its core concepts.
What makes Swift a protocol-oriented language, and how can protocols be used to create abstractions and to enable code reuse? That’s what we’ll take a look at in this Basics article.
A look at the standard library’s Result type, what kind of situations that it might be useful in, and tips and tricks that can be good to keep in mind when working with it.
Let’s explore how optional values work in Swift, including how they’re implemented under the hood, and what sort of techniques that we can use to handle them.
An overview of Swift’s five different levels of access control, how they work, and when each of them might be useful in practice.
How enums work in Swift, a look at some of their most prominent features, and examples of situations in which they can be incredibly useful.
A look at a few different ways that closures can be defined and used in Swift, the flexibility of Swift’s closure syntax, and how behaviors like escaping and capturing may impact our code.
A recap of the basics of SwiftUI, Apple’s declarative new UI framework for building apps across all of their platforms. How to build custom views and modify existing ones, how to manage local state within a view, and how to compose multiple views to form new ones.
Measuring the time complexity of a piece of code is a common technique used to optimize algorithms and other kinds of functions, by estimating their cost in terms of execution time. Let’s take a look at how to use “big O notation” to describe, measure, and improve the time complexity of a few different functions.
Let’s take a look at Swift’s String API — why it’s designed the way it is, and how it deals with some of the challenges of accurately representing text in a modern app. Also, how to subscript a string, extracting and working with substrings, and how strings compare to other kinds of collections.
One way of transforming values in Swift is by mapping a collection into an array of new values, using a transform. The Swift standard library offers three main APIs for that kind of mapping — map, flatMap and compactMap. Let’s take a look at how they work.
Swift enables us to create generic types, protocols, and functions, that aren’t tied to any specific concrete type — but can instead be used with any type that meets a given set of requirements. Let’s take a look at how generics work in Swift, and how to create our own.
Swift types can, in general, be divided into two categories — value types and reference types — which determines how they will be passed between different functions and other code scopes. Let’s take a look at what some of the practical implications of that are.
Just like modern versions of Objective-C, Swift uses the ARC (Automatic Reference Counting) memory management model. Let’s take a look at how ARC works, and how to avoid common memory-related issues, such as retain cycles.
How an application deals with errors and unexpected values is arguably just as important as how it deals with valid results. Let’s take a look at a few key techniques that can help us provide a better user experience whenever an error was encountered within our code.
Adding animations to an app can be a great way to both delight users, and to draw their attention to certain information or actions, through motion. When deployed in the right places, animations can really make an app appear more polished and easy to use. Let’s take a look at how to get started.
Introduced in Swift 4, the Codable API enables us to leverage the compiler in order to generate much of the code needed to encode and decode data to/from a serialized format, like JSON. Let’s take a look at how to use it.
Most apps these days need a way to download data from the Internet — whether that’s files, images, or by talking to some form of web API through a format like JSON. Let’s take a look at how to do that using Foundation’s URLSession API.
Using unit tests, and other forms of automated testing, can be a great way to protect a code base against regressions and reduce the need for manual testing. Let’s take a look at how to get started.
Just like how a UIView can be added to another UIView to form a hierarchy, a view controller can become the child of another view controller. Let’s take a look at how to do that.
Grand Central Dispatch is one of the few different options available to us when it comes to asynchronous programming in Swift. Let’s take a look at how it works and how to use it.
Auto Layout has undergone quite a lot of changes and improvements over the years, in particular with the introduction of layout anchors in iOS 9. Let’s take a look at how they work.