Swift Talk

A weekly video series on Swift programming.

Subscribers-Only

Subscribers Only

#58 Red-Black Trees 31:51

Building on the binary search tree code from episode #56, we implement red-black trees as self-balancing tree data structures and benchmark their performance.

Subscribers-Only

Subscribers Only

#56 Binary Search Trees 27:00

In this episode, we implement a binary search tree as an alternative to the sorted array from the last episode. We benchmark the performance of insertion and lookup in both data structures, with some surprising results.

#55 Sorted Arrays with Binary Search 26:51

Károly joins us to improve our sorted array implementation from episode #35 using binary search. We benchmark both implementations to learn about their real-world performance.

#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
Subscribers-Only

Subscribers Only

#24 Delegates & Callbacks 15:29

We discuss the pros and cons of delegates versus callback functions and why delegate protocols are always class only.

#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. Mutation
  3. Structs
  4. Value Types
October 21, 2016
Subscribers-Only

Subscribers Only

#20 Understanding Value Type Performance 18:51

In this episode we wrap NSMutableData in a struct while maintaining value semantics. Then we implement copy-on-write to make it efficient and discuss how the standard library uses the same approach.

  1. Copy-on-Write
  2. Structs
  3. Value Types
October 14, 2016

#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.

Subscribers-Only

Subscribers Only

#14 Growing Trees with Classes and Structs 28:11

We build a tree structure beginning with a flat array of Ledger account names. We first implement the tree using a class, and then we refactor it to a struct and discuss the differences and tradeoffs involved.

Subscribers-Only

Subscribers Only

#8 Networking: POST Requests 18:40

We extend the networking code from the first episode to support POST requests. Besides using Swift's enums with associated values and generics, we get to implement a map function on a custom data type.

#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.