Tiny Networking Library
We make use of Swift's generics and structs to build a simple network layer with great testability.
Episode 1 · Jun 17, 2016
We make use of Swift's generics and structs to build a simple network layer with great testability.
Episode 1 · Jun 17, 2016
We create attributed strings from CommonMark. We continually refactor our code to make the central logic short and understandable.
Episode 2 · Jun 17, 2016
We explore different approaches to factor out asynchronous loading code from view controllers, using protocols, container view controllers, and generics.
Episode 3 · Jun 24, 2016
We add customizable styles to our CommonMark renderer from episode #2.
Episode 4 · Jul 1, 2016
We refactor our code by moving the app's flow from the storyboard into a separate coordinator class. This avoids view controllers having implicit knowledge of their context.
Episode 5 · Jul 8, 2016
We leverage Swift's generics to keep our table view controller code clean.
Episode 6 · Jul 15, 2016
We create an abstraction around stack views using enums to specify UI elements in a declarative style.
Episode 7 · Jul 22, 2016
We add POST support to a simple networking layer, using Swift's enums with associated values and generics.
Episode 8 · Jul 29, 2016
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.
Episode 9 · Aug 5, 2016
We give a quick introduction to Ledger itself and to the Mac app we're going to build.
Episode 10 · Aug 12, 2016
Expressions are at the heart of Ledger. We write an evaluator for this expression language in a test-driven way.
Episode 11 · Aug 12, 2016
Writing the code for evaluating transactions required continuous refactoring to keep our code simple and clean.
Episode 12 · Aug 19, 2016
We look at two different techniques to parse a simple expression language: handwritten parsers and parser combinators.
Episode 13 · Aug 26, 2016
We build a tree structure from an 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.
Episode 14 · Sep 2, 2016
Join us in the functional programming gym to stretch your object-oriented comfort zone while we lay the groundwork for a parser combinator library.
Episode 15 · Sep 9, 2016
We implement some of the more challenging parts of parser combinators.
Episode 16 · Sep 16, 2016
We connect multiple view controllers using a coordinator and callback functions. We simplify the control flow by refactoring the UI state into its own struct.
Episode 17 · Sep 23, 2016
We leverage the existing infrastructure of our app to add a search field with very little code.
Episode 18 · Sep 30, 2016
We build a flexible sort descriptor abstraction on top of Swift's native sort methods, which is dynamic and type safe.
Episode 19 · Oct 7, 2016
We use copy-on-write to write an efficient struct wrapper around NSMutableData and discuss how the standard library uses the same approach.
Episode 20 · Oct 14, 2016
We can change structs by mutation, functional chaining, and inout parameters. We discuss how they differ at the call site and why they’re all equivalent.
Episode 21 · Oct 21, 2016
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.
Episode 22 · Oct 28, 2016
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!
Episode 23 · Nov 4, 2016
We discuss the pros and cons of delegates versus callback functions and why delegate protocols are always class only.
Episode 24 · Nov 11, 2016
We add support for caching network requests without altering our original networking abstraction.
Episode 25 · Nov 18, 2016
We build a generic, type-safe table view controller that can handle multiple cell classes.
Episode 26 · Nov 25, 2016
A lightweight generic wrapper around Foundation's notification API lets us avoid boilerplate code and provides a type-safe API.
Episode 27 · Dec 2, 2016
We extend our notification wrapper from episode #27 and discuss an alternative protocol-based approach.
Episode 28 · Dec 9, 2016
We refactor a class hierarchy using a protocol and discuss the differences between both approaches.
Episode 29 · Dec 16, 2016
We talk about the importance of types and interfaces as tools to express your intent precisely and to set the proper boundaries.
Episode 30 · Dec 30, 2016
Mutating a nested untyped dictionary can be a challenge. To solve it we discuss the mutability of value types and the concept of l-values.
Episode 31 · Jan 6, 2017
We show how to use the Collection protocol to make an extension available not just on array, but on all collections.
Episode 32 · Jan 13, 2017
We make our collection extension even more generic by implementing it on the Sequence protocol.
Episode 33 · Jan 20, 2017
We take a look at how reactive programming challenges us to think differently.
Episode 34 · Jan 27, 2017
We build a sorted array type on top of Swift's native array and make it conform to the Collection protocol.
Episode 35 · Feb 3, 2017
We implement a Futures type that we can use instead of callbacks as a first step towards a reactive library.
Episode 36 · Feb 10, 2017
We build the basics for a custom index set collection type.
Episode 37 · Feb 17, 2017
Conforming to the Sequence protocol allows us to efficiently iterate over the elements, and we gain all of its useful functionality.
Episode 38 · Feb 24, 2017
We extend the Future type of a previous episode to a simple reactive library. Along the way, we dive into debugging a reference cycle in our implementation.
Episode 39 · Mar 3, 2017
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.
Episode 40 · Mar 10, 2017
To conform IndexSet to the Collection protocol we implement a custom index type along the way.
Episode 41 · Mar 17, 2017
We make our Signal implementation thread-safe by safeguarding the access to shared resources.
Episode 42 · Mar 24, 2017
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.
Episode 43 · Mar 31, 2017
We set up our development environment using the Swift package manager and Docker.
Episode 44 · Apr 7, 2017
We implement a type safe and Swift-like routing infrastructure that's pretty different from the common approach of most web frameworks.
Episode 45 · Apr 14, 2017
We look at multiple ways to create variables that have a class type but also conform to a protocol.
Episode 46 · Apr 21, 2017
Brandon from Kickstarter shows us how they write highly testable code with view models. We integrate Apple Pay payments and look at their open-source codebase.
Episode 47 · Apr 28, 2017
We implement a lightweight wrapper around the libpq C library.
Episode 48 · May 5, 2017
Brandon from Kickstarter shows their approach of unifying all potential entry points into an iOS app using a common route enum, both in a simple demo implementaion and in their open source code base.
Episode 49 · May 12, 2017
We extend our libpq wrapper to handle queries with properly escaped parameters. To achieve this, we have to dive deep into Swift's unsafe pointer APIs.
Episode 50 · May 19, 2017
Brandon from Kickstarter demos how the company uses playgrounds to prototype and style individual view controllers.
Episode 51 · May 26, 2017
Swift 4's new features lets us delete code we've written in previous episodes.
Episode 52 · Jun 2, 2017
Lisa from Kickstarter shows us their test-driven development process to reactive programming.
Episode 53 · Jun 9, 2017
We write a dedicated target-action to make it easier to augment existing UI controls with callbacks.
Episode 54 · Jun 16, 2017
Together with Károly, we improve our sorted array implementation using binary search. We benchmark both implementations to learn about their real-world performance.
Episode 55 · Jun 23, 2017
We look at binary search trees as an alternative to last episode's sorted array implementation. We benchmark the performance of insertion and lookup in both data structures, with some surprising results.
Episode 56 · Jun 30, 2017
Today we're joined by Rob Napier, who explains why and how to add certificate pinning to your app.
Episode 57 · Jul 7, 2017
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.
Episode 58 · Jul 14, 2017
We take a look at features like renaming, extracting expressions, extracting methods, and more.
Episode 59 · Jul 21, 2017
We show some of our favorite new productivity features in Xcode 9.
Episode 60 · Jul 28, 2017
We recap the tradeoffs between classes and structs and start implementation of our new type, leveraging Swift 4's keypaths.
Episode 61 · Aug 4, 2017
We show the reducer pattern to simplify state management and to make typical view controller code more testable.
Episode 62 · Aug 11, 2017
We refine the observation capabilities of our new data type.
Episode 63 · Aug 18, 2017
We build a component similar to NSFetchedResultsController to decouple our view data and to drive table view animations.
Episode 64 · Aug 25, 2017
We create a custom Quick Look extension to visualize binary tree structures in playgrounds.
Episode 65 · Sep 1, 2017
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.
Episode 66 · Sep 8, 2017
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.
Episode 67 · Sep 15, 2017
We extend our Elm-style app with a more dynamic view hierarchy by adding a navigation controller and a table view.
Episode 68 · Sep 22, 2017
We build a reactive array type on top of the reactive list from episode #67 and implement a filter method.
Episode 69 · Sep 29, 2017
We use the reactive array type from episodes #67 and #69 to back a table view. This allows us to correctly animate changes in the underlying data, even with filter and sort transformations applied.
Episode 70 · Oct 6, 2017
Brandon Kase joins us to show how Swift's type system can be leveraged to check file paths at compile time.
Episode 71 · Oct 13, 2017
We introduce a project we're going to work on over a few episodes. To get familiar with the code, we build a new feature using the app's view-state driven approach.
Episode 72 · Oct 20, 2017
We experiment with reactive view bindings that don't rely on runtime programming.
Episode 73 · Oct 27, 2017
We continue to expand our experimental view binding mechanism to implement dark mode in our app.
Episode 74 · Nov 3, 2017
We clean up our layout code by introducing helper functions that leverage Swift's key paths.
Episode 75 · Nov 10, 2017
We look at an example of a reactive pipeline with surprising behavior, discuss why it occurs, and how it could be improved.
Episode 76 · Nov 17, 2017
We refactor the simple reactive library from the last episode using topological sorting to avoid any temporarily wrong values.
Episode 77 · Nov 24, 2017
We write a simple CSV parser as an example demonstrating how to work with Swift's String and Substring types.
Episode 78 · Dec 1, 2017
We benchmark the CSV parsing code from the previous episode and refactor it to become an order of magnitude faster.
Episode 79 · Dec 8, 2017
We look at how to work with ranges in a mixed Swift String/NSString environment.
Episode 80 · Dec 15, 2017
We use Xcode's memory debugger to resolve all the reference cycles in our glitch-free reactive code and introduce a proper ownership model.
Episode 81 · Dec 22, 2017
We refactor a simple flow layout to have a functional interface, disentangling the layout code from UIKit code.
Episode 82 · Jan 5
We look at different techniques for wrapping analytics APIs in Swift and discuss their advantages and disadvantages.
Episode 83 · Jan 12
Today we're releasing the early access edition of our new App Architecture book. We explain how it came about, what's in it, and how early access works.
Episode 84 · Jan 19
We write a wrapper around the libgit2 C library to work with Git repositories from macOS and iOS apps — and for the fun of using Swift's pointer APIs!
Episode 85 · Jan 26
We add a mini player to the MVC variant of the sample app found in our App Architecture book. We adjust our storyboard and discuss how to adapt the architecture.
Episode 86 · Feb 2
We continue implementing a mini player in the MVC variant of the sample app found in our App Architecture book.
Episode 87 · Feb 9
We discuss the capabilities and limitations of enums and classes when designing extensible libraries.
Episode 88 · Feb 16
We show how protocol composition can be used to design extensible libraries, thereby solving the so-called "Expression Problem."
Episode 89 · Feb 23
We implement a concurrent version of the map method for arrays.
Episode 90 · Mar 2
We extend a basic Markdown library using protocol composition to add support for syntax highlighting in Swift code blocks
Episode 91 · Mar 9
We use Swift's pointer APIs to read a text file and split it into lines without using Swift's collection and string types.
Episode 92 · Mar 16
We discuss many considerations and techniques for working with optionals.
Episode 93 · Mar 23
This episode marks the beginning of a new series where we refactor a hand-coded settings form into a reusable, declarative form library. In this episode, we build the base version and discuss the design goals of the library.
Episode 94 · Mar 30
We begin to refactor the imperative table view code from the last episode, working toward a more declarative approach of defining our form.
Episode 95 · Apr 6
We continue refactoring our forms code by creating a form table view controller as the first reusable component.
Episode 96 · Apr 13
We refactor the form driver class to be reusable and define the entire form in a simple function.
Episode 97 · Apr 20