Swift Talk

A weekly video series on Swift programming.

#37 Custom Collections: Building IndexSet 18:52

We take a look at how to implement a custom collection type. As an example, we build a simple IndexSet implementation. In upcoming episodes we'll make this type conform to collection protocols.

#35 Sorted Arrays (Collections #3) 16:42

We look at extracting a sorted array type in order to increase code clarity. We'll also make it conform to Collection.

#33 Sequence & Iterator (Collections #2) 16:54

We continue to make the collection extension from the last episode more generic: we implement it on the Sequence protocol and discuss infinite sequences in the process.

#31 Mutating Untyped Dictionaries 15:14

We solve an interesting challenge from a Stack Overflow question: mutating a nested untyped dictionary. In the process, we discuss the mutability of value types and the concept of l-values.

  1. Mutation
  2. Value Types
January 6, 2017

#29 Protocols & Class Hierarchies 16:02

We refactor a class hierarchy using a protocol and discuss the differences between both approaches.

#27 Typed Notifications (Part 1) 17:52

We build a lightweight generic wrapper around Foundation's notification API. This allows us to abstract away common boilerplate code and to work with a type-safe interface.

#25 Network Caching 23:33

We come back to our unfinished Swift Talk iOS app and implement a lightweight network cache for offline support. We keep our networking code from episode #1 untouched to maintain a clear separation of concerns.

#23 Splitting Arrays 24:07

We talk about a familiar but surprisingly tricky problem: splitting an array into groups of elements. We discuss the pros and cons of our own solutions along with the solutions people sent us via Twitter!

  1. QA
  2. State
  3. Algorithms
November 4, 2016

#21 Structs and Mutation 16:07

We look at multiple ways to change structs: mutation, functional chaining, and inout parameters. We discuss how they differ at the call site and why they’re all equivalent.

  1. inout
  2. Structs
  3. Mutation
  4. Value Types
October 21, 2016

#19 From Runtime Programming to Functions 23:05

We build a flexible sort descriptor abstraction, similar to NSSortDescriptor, on top of Swift's native sort methods. Because we make use of generics and first-class functions, the result is dynamic and type safe.

#17 Ledger GUI Architecture 18:31

We connect multiple view controllers using a central coordinating object and callback functions. Then we refactor the UI state into its own struct to simplify the control flow.

#15 Building Parser Combinators (Part 1) 16:22

We implement the basic building blocks of a parser combinator library. Join us in the functional programming gym to stretch your object-oriented comfort zone!

#13 Parsing Techniques 25:23

We look at two different techniques to parse a simple expression language: handwritten parsers and parser combinators.

#11 Evaluating Expressions 29:36

We write an evaluator for a simple expression language. We write our code in a test-driven way, which saves us time and helps us verify the correctness the code.

#10 Project Introduction: Ledger GUI 07:45

We show a quick overview of our new project: a bookkeeping app that's based on plain text.

  1. Overview
  2. Ledger
August 12, 2016

#9 Q&A 13:54

In this episode, we answer some of the questions we've received over the past few weeks. We cover networking, table views, stack views, our App class, and testing.

#7 Stack Views with Enums 21:43

Stack Views are great for prototyping. To make them even easier to set up in code, we create an abstraction using enums to specify UI elements in a declarative style.

#5 Connecting View Controllers 20:14

We refactor our code by moving the app's flow from the storyboard into a separate class. Our goal is to manage the view controller flow from a central place so that view controllers don't have implicit knowledge of their context.

#3 Loading View Controllers 21:50

Many view controllers have to load data asynchronously. We explore different options to factor out this code using protocols, container view controllers, and generics.

#1 Networking 22:49

We explore an alternative approach to building the networking layer of an app. We make use of Swift's generics and structs to end up with simple, testable code.