Point-Free is a video series about functional programming and the Swift programming language. Each episode covers a topic that may seem complex and academic at first, but turns out to be quite simple. At the end of each episode we’ll ask “what’s the point?!”, so that we can bring the concepts back d…
Brandon Williams & Stephen Celis
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- We tackle the first screen in our Reminders app rewrite: the reminders lists view. We will take the `@FetchAll` property wrapper for a spin, which is like SwiftData's `@Query` macro, but unlike `@Query` it can be used from both the view _and_ observable models. And we will even get some end-to-end, snapshot test coverage of our feature in place.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- What are the best, modern practices for persisting your application's state? We explore the topic by rebuilding Apple's Reminders app from scratch using SQLite, the most widely deployed database in all software. We will start by designing the schema that models our domain.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- We close out our series on SQL query building with a library that can generate some seriously complex queries that select, join, group, aggregate, and filter data across tables. And we show how it can all play nicely with SQL strings by introducing a safe interface to SQL _via_ a custom string interpolation.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- It's time to support one of the most complicated parts of SQL in our query building library: joins. We will design an API that is simple to use but leverages some seriously advanced language features, including type-level parameter packs.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- We dive into the "relational" part of relational databases by learning how tables can reference one another, the various ways queries can join these relations together, and even how to aggregate nuanced data across these relations, all without ever hopping over to Xcode.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- We tackle one of SQL's most important aspects in our query builder: the `WHERE` clause, which filters the results of a query. And we will do so in a type-safe manner that prevents us from writing nonsensical queries in Swift even when they are syntactically valid in SQL.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- We add sorting to our SQL builder, which will give us a powerful, succinct syntax for controlling the order of results. We will start small but build up to parameter packs and even a custom result builder to get the most flexibility out of our API.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- We now have a type-safe syntax for generating `SELECT` statements using key paths to the columns we want to select, but while this syntax is nice and what many existing libraries use, we can do better. Let's introduce a more advanced syntax that leverages variadic generics and supports more complex query expressions.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- We begin to build a type-safe SQL query builder from scratch by familiarizing ourselves with the `SELECT` statement. We will explore the SQLite documentation to understand the syntax, introduce a type that can generate valid statements, and write powerful inline snapshot tests for their output.
Every once in awhile we release a new episode free for all to see, and today is that day! Please enjoy this episode, and if you find this interesting you may want to consider a subscription https://www.pointfree.co/pricing. --- We finish a sneak peek of our upcoming Structured Queries library by showing how queries built with the library can be reused and composed together, and how we can replace all of the raw queries in our application with simpler, safer query builders.
Every once in awhile we release a new episode free for all to see, and today is that day! Please enjoy this episode, and if you find this interesting you may want to consider a subscription https://www.pointfree.co/pricing. --- Last week we released SharingGRDB, an alternative to SwiftData powered by SQLite, but there are a few improvements we could make. Let's take a look at some problems with the current tools before giving a sneak peek at the solution: a powerful new query building library that leverages many advanced Swift features that we will soon build from scratch.
Every once in awhile we release a new episode free for all to see, and today is that day! Please enjoy this episode, and if you find this interesting you may want to consider a subscription https://www.pointfree.co/pricing. --- We celebrate 7 years with a live stream! We discuss some recent updates around our popular [Sharing](http://github.com/pointfreeco/swift-sharing) library; open source [SharingGRDB](http://github.com/pointfreeco/sharing-grdb) live, which is a new lightweight alternative to SwiftData that is powered by Sharing and [GRDB](http://github.com/groue/GRDB.swift); and we give a sneak peek of an upcoming series and library.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- We are now driving several features using SQLite using a simple property wrapper that offers the same ergonomics as Swift Data's `@Query` macro, and automatically keeps the view in sync with the database. Let's add one more feature to leverage _dynamic_ queries by allowing the user to change how the data is sorted.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- Let's leverage our new `@Shared` SQLite strategy by adding a brand new feature: archiving. We will see how easy it is to incorporate queries directly into a SwiftUI view, and we will expand our tools to support even more kinds of queries.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- SQLite offers a lot of power and flexibility over a simple JSON file, but it also requires a lot of boilerplate to get working. But we can hide away all that boilerplate using the `@Shared` property wrapper and end up with something that is arguably nicer than Swift Data's `@Query` macro!
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- Persisting app state to user defaults or a JSON file is simple and convenient, but it starts to break down when you need to present this data in more complex ways, and this is where SQLite really shines. Let's get a handle on the problem with some state that is currently persisted to a JSON file, and let's see how SQLite fixes it.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- We close out our tour of the Sharing library by showing how easy it is to test code that uses the `@Shared` property wrapper without worrying about values bleeding between tests and the simulator. And we'll take the "in-memory" shared key for a spin by building one final feature.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- `@Shared` is far more than a glorified version of `@AppStorage`: it can be customized with additional persistence strategies, including the file storage strategy that comes with the library, which persists far more complex data than user defaults. We will create a complex, new feature that is powered by the file system.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- We show how the `@Shared` property wrapper, unlike `@AppStorage`, can be used _anywhere_, not just SwiftUI views. And we show how `@Shared` has some extra bells and whistles that make it easier to write maintainable Xcode previews and avoid potential bugs around "string-ly" typed keys and default values.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- "Sharing" is a brand new library for sharing state throughout your application and to external systems like user defaults, the file system, and more. We start our tour of the library by comparing it to a tool that inspired its design: SwiftUI's `@AppStorage`.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- We conclude our introductory series on SQLite by showing how to live update SwiftUI views powered by database using GRDB's "value observation." Along the way we will tackle quite a few Swift 6 concurrency issues, and we will tie things in a bow by showing how the SwiftUI environment can vastly simplify how our application is powered by SQLite.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- Let's see how to integrate a SQLite database into a SwiftUI view. We will explore the tools GRDB provides to query the database so that we can display its data in our UI, as well as build and enforce table relations to protect the integrity of our app's state. And we will show how everything can be exercised in Xcode previews.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- Interfacing with SQLite's C library from Swift is possible, but clunky. Luckily there are friendlier, "Swiftier" interfaces the community has built, so let's take a look at the most popular: GRDB. We'll explore how it can help us avoid pitfalls and boilerplate required to use the C library, and how its typed SQL helpers can even help us avoid runtime issues at compile time.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- SQLite is one of the most well-crafted, battle-tested, widely-deployed pieces of software in history, and it's a great fit for apps with more complex persistence needs than user defaults or a JSON file. Let's get familiar with the library, starting with a crash course in interacting with C code from Swift.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- We zoom out a bit to get a greater appreciation for how `Equatable` and `Hashable` are used throughout the greater language and ecosystem, including actors, standard library types, SwiftUI, and more.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- We've studied `Equatable` and `Hashable`, their laws, and saw how value types as simple bags of data easily conform via "structural" equality. What about reference types? Reference types are an amalgamation of data _and_ behavior, and that data can be mutated in place at any time, so how can they reasonably conform to these protocols?
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- While the documentation for `Equatable` discusses the notions of "equivalence relation" _and_ "substitutability", there are conformances in the Standard Library that run afoul, but for pragmatic reasons. Let's explore them and then dive deeper into a related protocol: `Hashable`.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- In this series we go back to basics with a deep dive into the subject of `Equatable` types. Equatability is a deceptively simple topic. It is a surprisingly tricky protocol that has some very specific semantics that must be upheld baked into it, and there are many misconceptions on how one can or should conform types to this protocol.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- We round out our series with one more feature: the ability for our users to manage a list of their favorite facts. It will allow us to explore a complex side effect, persistence, and show how the same Swift code can save and load data across iOS app launches _and_ web page refreshes.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- We've already covered a lot of ground and could have ended the series last week, but let's do a few more things to show just how powerful cross-platform domain modeling can be by adding a _new_ feature to our cross-platform application and see just how easy it is to integrate with SwiftUI, UIKit, _and_ WebAssembly.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- We will introduce UI controls and focus logic to our SwiftWasm application by leveraging a binding type inspired by SwiftUI, and we will see how similar even our view logic can look across many platforms.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- We will introduce navigation APIs to our Wasm application, starting simply with an alert before ramping things up with a `dialog` tag that can be fully configurable from a value type that represents its state and actions.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- Let's dial up the complexity of our Wasm application! We'll introduce some async logic in the form of a network request. We'll take steps to not only control this dependency, but we'll do so across both Apple and Wasm platforms, and we'll isolate its interface from its live implementation to speed up our builds and reduce our app's size.
Every once in awhile we release a new episode free for all to see, and today is that day! Please enjoy this episode, and if you find this interesting you may want to consider a subscription https://www.pointfree.co/pricing. --- We are going to take a Swift feature _into the browser_. We will set up a WebAssembly application from scratch, show how to run and debug it, and even set up some basic UI. And then we will integrate our existing model into it, all powered by the magic of Swift's Observation framework.
Every once in awhile we release a new episode free for all to see, and today is that day! Please enjoy this episode, and if you find this interesting you may want to consider a subscription https://www.pointfree.co/pricing. --- It's time to go cross-platform! We will take a feature written in Swift and use it in vastly different situations, including not only SwiftUI and UIKit, but beyond Apple's frameworks and ecosystems. We will start with a baby step and introduce our feature to a third party view paradigm, Airbnb's Epoxy.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- While we rebuilt SwiftUI bindings in UIKit to power state-driven navigation, that's not all SwiftUI uses them for! Let's see what it takes to power `UIControl`s from model bindings. And finally, let's ask "what's the point?” by comparing the tools we've built over many episodes with the alternative.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- We round out our stack navigation tools with support for an `@Environment`-like feature for holding onto the stack's path, a `NavigationLink`-like feature for pushing features onto the stack from anywhere, and we'll handle every corner case from deep-linking to user dismissal.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- We have now implemented tree-based navigation in UIKit, driven by the Observation framework, but there is another form of navigation to think about: stack-based navigation, where you drive your navigation from a flat collection of states rather than a heavily-nested type. Let's leverage Observation to build a really nice tool for stack-based navigation.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- While SwiftUI bindings were almost the perfect tool for UIKit navigation, they unfortunately hide some crucial information that we need to build out our tools. But never fear, we can rebuild them from scratch! Let's build `@Binding` and `@Bindable` from scratch to see how they work, and we will use them to drive concise, tree-based navigation using enums.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- We have built the foundation of powerful new UIKit navigation tools, but they're not quite finished. Let's improve these APIs to handle dismissal by leveraging another SwiftUI tool: bindings. We will see how SwiftUI bindings are (almost) the perfect tool for UIKit navigation, and we will see where they fall short.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- Now that we have a tool that brings the power of the Observation framework to UIKit, let's put it through the paces. We will use it to build state-driven navigation tools that can drive alerts, sheets, popovers, drill-downs, and more, and they will look a lot like SwiftUI's navigation tools.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- It's time to build modern tools for UIKit from scratch, heavily inspired by SwiftUI and using the Observation framework. Surprisingly, Swift 5.9's observation tools _can_ be used in UIKit, and in fact they work _great_, despite being specifically tuned for SwiftUI.
Every once in awhile we release a new episode free for all to see, and today is that day! Please enjoy this episode, and if you find this interesting you may want to consider a subscription https://www.pointfree.co/pricing. --- We finish building a modern UIKit application with brand new state-driven tools, including a complex collection view that can navigate to two child features. And we will see that, thanks to our back-port of Swift's observation tools, we will be able to deploy our app all the way back to iOS 13.
Every once in awhile we release a new episode free for all to see, and today is that day! Please enjoy this episode, and if you find this interesting you may want to consider a subscription https://www.pointfree.co/pricing. --- As we approach WWDC24 and 5 years of SwiftUI, let's talk about… UIKit!
Every once in awhile we release a new episode free for all to see, and today is that day! Please enjoy this episode, and if you find this interesting you may want to consider a subscription https://www.pointfree.co/pricing. --- We conclude the series by stretching our use of the `@Shared` property wrapper in isowords to two more features: saved games and user defaults. In the process we'll eliminate hundreds of lines of boilerplate and some truly gnarly code.
Every once in awhile we release a new episode free for all to see, and today is that day! Please enjoy this episode, and if you find this interesting you may want to consider a subscription https://www.pointfree.co/pricing. --- Let's apply the Composable Architecture's new state sharing tools to something even more real world: our open source word game, isowords. It currently models its user settings as a cumbersome dependency that requires a lot of code to keep features in sync when settings change. We should be able to greatly simplify things with the `@Shared` property wrapper.
Every once in awhile we release a new episode free for all to see, and today is that day! Please enjoy this episode, and if you find this interesting you may want to consider a subscription https://www.pointfree.co/pricing. --- We finish refactoring the SyncUps application to use the Composable Architecture's all new state sharing tools. We will see that we can delete hundreds of lines of boilerplate of coordination between parent and child features, _and_ we won't have to sacrifice any testability, including the _exhaustive_ testability provided by the library.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- In our last series we developed a wonderful way to share state between features in the Composable Architecture, and even persist it, all without sacrificing testability, but we also didn't get to show the (just now released) tools being used in real world applications, so let's do just that, starting with SyncUps.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- It's incredible how easy `@Shared` makes it to persist complex data types to the file system, but currently it completely ruins our ability to test features that use it. Let's fix that, and we will also explore what it means to derive a small piece of shared state from a bigger piece of shared state.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- While user defaults is convenient for persisting simple bits of state, more complex data types should be saved to the file system. This can be tricky to get right, and so we take the time to properly handle all of the edge cases.
Subscriber-Only: Today's episode is available only to subscribers. If you are a Point-Free subscriber you can access your private podcast feed by visiting https://www.pointfree.co/account. --- We can now persist simple bits of state to user defaults using the `@Shared` property wrapper, but there is more work to be done. We need to observe changes to user defaults in order to play those changes back to `@Shared`, and we need to put in a bit of extra work to make everything testable.