Swift Talk

A weekly video series on Swift programming.

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

Subscribers-Only

Subscribers Only

#2 Rendering CommonMark 23:15

We create attributed strings from CommonMark. We continually refactor our code to make the central logic short and understandable.

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

Subscribers-Only

Subscribers Only

#4 Rendering CommonMark (Part 2) 18:33

We continue building the CommonMark renderer we started in episode #2. This time, we add customizable styles using structs and inout parameters.

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

Subscribers-Only

Subscribers Only

#6 Generic Table View Controllers 19:42

We explore how Swift's generics can be used to create a simple, reusable table view controller. As a welcome side effect, this process helps us keep our view controller code clean.

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

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.

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

#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

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

Subscribers-Only

Subscribers Only

#12 Evaluating Transactions 25:43

We evaluate transactions using the code from the previous episode. We need continuous refactoring to keep our code simple and clean.

#13 Parsing Techniques 25:23

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

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.

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

Subscribers-Only

Subscribers Only

#16 Building Parser Combinators (Part 2) 21:30

We continue to implement some of the more challenging parts of parser combinators. Join us for mental gym session part two!

#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

#18 Adding Search to the Ledger GUI App 16:00

In this episode, we implement search functionality for our Ledger GUI app. In the process, we leverage several aspects we've talked about before, such as connecting view controllers, managing application state, and parsing user input.

  1. Parsing
  2. Architecture
September 30, 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.

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. Value Types
  2. Copy-on-Write
  3. Structs
October 14, 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. Mutation
  2. inout
  3. Value Types
  4. Structs
October 21, 2016
Subscribers-Only

Subscribers Only

#22 Command Line Tools with Swift 17:17

We show how we build simple command line tools leveraging the Cocoa frameworks. We use the Swift Package manager to include dependencies in our project.

  1. Package Management
  2. Command Line
October 28, 2016

#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. Algorithms
  3. State
November 4, 2016
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.

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

Subscribers-Only

Subscribers Only

#26 Generic Table View Controllers (Part 2) 23:30

We show how you can build a generic, type-safe table view controller that can display different types of items using multiple cell classes.

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

Subscribers-Only

Subscribers Only

#28 Typed Notifications (Part 2) 18:02

We extend the typed notifications code from the last episode to custom notifications and discuss an alternative protocol-based approach.

#29 Protocols & Class Hierarchies 16:02

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

Subscribers-Only

Subscribers Only

#30 Interfaces 16:07

We talk about the importance of types and interfaces as tools to express your intent precisely and to set the proper boundaries.

  1. Generics
  2. Architecture
  3. Types
December 30, 2016

#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

#32 Array, ArraySlice & Collection (Collections #1) 15:16

We show how to make an extension on array available to other collections: first, we implement it for array slices, then we implement it as a protocol extension for all collections.

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

Subscribers-Only

Subscribers Only

#34 Reactive Programming 26:12

We take a look at reactive programming and see how it challenges us to think differently.

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

Subscribers-Only

Subscribers Only

#36 Futures (Reactive Programming #2) 17:30

We look at implementing a Futures type that we can use instead of callbacks. This is the first step toward a simple implementation of a reactive library.

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

Subscribers-Only

Subscribers Only

#38 Custom Collections: IndexSet as Sequence 14:08

In this episode, we make a custom collection conform to Sequence. This allows us to efficiently iterate over the elements, and we gain all the useful functionality of Sequence.

#39 From Futures to Signals (Reactive Programming #3) 23:45

We build upon the Future type of a previous episode to implement a simple reactive library. Along the way, we dive into debugging a reference cycle in our implementation.

Subscribers-Only

Subscribers Only

#40 Signal Ownership and Subscriptions (Reactive Programming #4) 16:28

We add the ability to map over signals and control subscriptions in a more fine-grained manner. Along the way, we improve the signal ownership model and implement the concept of disposables.

#41 Custom Collections: IndexSet as Collection (Collections #6) 16:51

In this final episode of our collection series, we make our custom IndexSet collection type conform to the Collection protocol, implementing a custom index type along the way.

Subscribers-Only

Subscribers Only

#42 Thread Safety (Reactive Programming #5) 23:36

We make our Signal implementation thread-safe by safeguarding the access to shared resources.

#43 View Controller Refactoring 16:52

We refactor some view controller logic while working on our upcoming tvOS app. Instead of letting multiple view controllers manage the navigation bar's state individually, we pull this code out and unify the logic in one place.

Subscribers-Only

Subscribers Only

#44 Setting Up a Swift Server-Side Project 24:33

In this first episode about server-side Swift applications, we set up our development environment using Docker and the Swift Package Manager.

#45 Server-Side Swift: Routing 22:47

We build the basic routing infrastructure to map paths to the code that should handle a particular request. We take a different approach than most web frameworks in an attempt to make the code type safe and more at home in Swift.

  1. Parsing
  2. Server
  3. Enums
April 14, 2017
Subscribers-Only

Subscribers Only

#46 Combined Class and Protocol Requirements 15:59

We look at multiple ways to create variables that have a class type but also conform to a protocol.

  1. Classes
  2. UIKit
  3. Protocols
April 21, 2017

#47 View Models at Kickstarter 33:58

Brandon from Kickstarter joins us and shows how the company uses view models to write highly testable code. We integrate Apple Pay payments and look at Kickstarter's open-source codebase.

Subscribers-Only

Subscribers Only

#48 Server-Side Swift: Interfacing with PostgreSQL 28:50

We start writing a lightweight wrapper around the libpq C library to interface with PostgreSQL.

#49 Deep Linking at Kickstarter 27:11

Brandon from Kickstarter joins us to discuss deep linking into an iOS app. We show how to unify all potential entry points into the app using a common route enum, and then we take a look at this pattern in Kickstarter's open source codebase.

Subscribers-Only

Subscribers Only

#50 Server-Side Swift: Interfacing with PostgreSQL (Part 2) 25:14

We continue buildling our PostgreSQL wrapper. This time, we add the possibility of using queries with properly escaped parameters. To achieve this, we have to dive deep into Swift's unsafe pointer APIs.

#51 Playground-Driven Development at Kickstarter 21:23

Brandon from Kickstarter is back to show us how the company uses playgrounds to prototype and style individual view controllers.

Subscribers-Only

Subscribers Only

#52 Deleting Code with Swift 4 11:49

We look at how we can delete code we wrote in previous episodes by taking advantage of some of the new features in Swift 4.

#53 Test-Driven Reactive Programming at Kickstarter 38:47

This week Lisa joins us to demonstrate the test-driven approach to reactive programming taken at Kickstarter.

Subscribers-Only

Subscribers Only

#54 UI Elements with Callbacks 16:27

We refactor a declarative wrapper around stack views we wrote in episode #7. Instead of wrapping UI controls to provide an interface with callbacks, we write a dedicated target-action class.

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

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.

#57 Certificate Pinning 24:31

Today we're joined by Rob Napier, who explains why and how to add certificate pinning to your app.

  1. Foundation
  2. Security
July 7, 2017
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.

#59 Refactoring with Xcode 9 12:34

We take a look at the new refactoring features of Xcode 9, including renaming, extracting expressions, extracting methods, and more.

  1. Xcode
  2. Refactoring
July 21, 2017
Subscribers-Only

Subscribers Only

#60 Xcode 9 Productivity Tips 14:24

We show some of our favorite new productivity features in Xcode 9.

  1. Xcode
July 28, 2017

#61 Mutable Shared Structs (Part 1) 30:10

We build an experimental data type that combines the advantages of both structs and classes. It allows shared mutable state while preserving the features of structs to make easy copies and observe changes.

Subscribers-Only

Subscribers Only

#62 Testable View Controllers with Reducers 31:00

We show how the reducer pattern can be used to make typical view controller code more testable.

#63 Mutable Shared Structs (Part 2) 22:59

We continue to experiment with our hybrid struct/class data type and incorporate the ability to add and remove more fine-grained observers.

Subscribers-Only

Subscribers Only

#64 Driving Table View Animations 30:24

We build a component similar to NSFetchedResultsController, but without the reliance on Core Data. This component can be reused whenever we need to drive table view animations.

#65 Playground QuickLook for Binary Trees 27:58

We create a custom Quick Look extension to visualize binary tree structures in playgrounds.

  1. Algorithms
  2. Trees
  3. Enums
September 1, 2017
Subscribers-Only

Subscribers Only

#66 The Elm Architecture (Part 1) 16:39

We refactor our reducer-based project from episode #62 to use The Elm Architecture. Instead of interacting with UIKit directly, we build a virtual view hierarchy and let our Elm framework do the rest.

#67 Reactive Data Structures: Linked Lists 25:58

We build a reactive linked list on top of reactive programming primitives. We implement a reduce method on this type, which does the minimum amount of work when the underlying data changes.

  1. Enums
  2. Reactive
  3. Types
  4. Collections
September 15, 2017
Subscribers-Only

Subscribers Only

#68 The Elm Architecture (Part 2) 24:59

We extend our Elm-style app with a more dynamic view hierarchy by adding a navigation controller and a table view.