A blog exploring functional programming and Swift.

2019 Year-in-review

Monday Dec 30, 2019

It’s the end of the year again, and we’re feeling nostalgic 😊. We’re really proud of everything we produced for 2019, so join us for a quick review of some of our favorite highlights.

We are also offering 30% off the first year for first-time subscribers. If you’ve been on the fence on whether or not to subscribe, now is the time!

Episodes

In 2018, we spread our attention across many important topics in functional programming so that we could get a firm foundation in the tools that functional thinking gives us. Things like functions, algebraic data types, map, contravariance, zip, protocol witnesses and more. This set the stage for 2019.

This year we produced 45 episodes (12 of them free!) for a total of 19 hours of video, and we focused on fewer topics and spent more time diving really deep into the concepts. We ended up leveraging almost everything we covered in 2018 in some shape or form. The basic units of composition from 2018 just kept appearing over and over again.

Here’s a summary of the broad topics we explored:

FlatMap

We started the year out with a 5-part series on flatMap. Last year we saw that the map and zip operations were powerful and universal, and that many types support these operations, not just arrays and optionals. The map operation allows us to access the value inside any generic context and apply a transformation to it. On the other hand, zip allows us to do something similar, except when you want to apply a transformation to many generic contexts at once.

Those transformations are powerful, and allow us to express many things, but there are still things we want to do with certain types that map and zip alone cannot do. This is what motivates flatMap! It is precisely the operation that allows us to chain together computations, whether it be computations on optionals, results, arrays or async values.

Random Number Generators

Last year we set the foundation for the atomic unit of randomness, Gen, from which more complex randomness can be derived (part 1, part 2, part 3), but this year we took it to the next level. By making a very small change to the definition of our Gen type, we are able to gain testability in our randomness, and we spent 2 🆓 episodes exploring how to make generative art with the Gen type:

Enum Properties

Although structs and enums have first class treatment in Swift and are awesome to use, structs tend to have nicer ergonomics than enums. We explored what it would look like for enums to get many of the affordances that structs have, and we built a CLI tool (with SwiftSyntax!) to generate a friendlier API for enums.

Parsers

We explored what functional programming has to say about parsers, and it turns out it has quite a bit to say! After exploring various API’s for parsers that we interact with in the Apple ecosystem, we distilled the essence of parsing into a single function signature. That signature led us to discover many amazing composability properties, and we demonstrated how lots of tiny parsers could be pieced together to form very complex parsers.

SwiftUI

We were very excited when SwiftUI was announced at WWDC. Its core ideas are rooted in some concepts that are well-supported by functional programming, such as view functions and declarative programming, and we knew we’d have a lot to say about it.

We started off by exploring what SwiftUI gives us out of the box so that we could understand what areas of application development it excels at, and where there is room for improvement. We released 3 free episodes showing how SwiftUI approaches the problems of state management, as well as a later free episode for how to do snapshot testing in a SwiftUI application.

Composable Architecture

Although SwiftUI solves some of the most complex problems we face building applications, it doesn’t solve all of them. We turned to functional programming to develop an architecture that attempts to solve 5 precise problems that every application faces, and that we feel every architecture story must account for:

  1. How to model the architecture using value types
  2. How to break down large features into smaller pieces
  3. How to isolate parts of the app into their own modules so that they don’t depend on each other
  4. How to model side effects in the architecture
  5. And how to test the architecture.

It took us a whopping 19 (‼️) episodes to accomplish this, and the results have been amazing.

🎉 2020 🎉

It was an incredible year, and thanks to all of our subscribers for supporting us and helping us create this content. We have a lot of great things planned for 2020: we have a few more things to discuss about the composable architecture, we have a few more advanced parser topics we want to cover, as well as some completely new topics and an exciting new project to announce!

To celebrate the end of the year we are also offering 30% off the first year for first-time subscribers. If you’ve been on the fence on whether or not to subscribe, now is the time!

See you in 2020!


Snapshot Testing SwiftUI

Monday Dec 23, 2019

SwiftUI is an incredible technology for building UI that is going to drastically change the way we build iOS applications. In UIKit we manage views by coordinating a bunch of mutable objects, but SwiftUI allows us to avoid all of those messy details by providing a declarative framework that lets us simply describe the view hierarchy.

However, since we are still in the early days of this technology, it is not yet clear how we are supposed to test a SwiftUI application. Almost everything that happens in a SwiftUI View is hidden from us, and so it can be hard to make assertions on logic that is happening inside the view.

Luckily there’s a very simple way to get broad test coverage on any SwiftUI view today, and it’s done using the snapshot testing library we open sourced one year ago!

In this week’s free episode we demonstrate how to add SnapshotTesting to the application we have been building over the past many weeks. We show off lots of really cool things:

  • It’s easy to add SnapshotTesting to our project via the Swift Package Manager and its Xcode integration.
  • We can immediately get snapshot test coverage on any SwiftUI view by using UIHostingController.
  • We can further get test coverage on alerts and modals if we properly host the controller in a test application with a UIWindow.
  • We can even further perform a kind of “integration test” by using the composable architecture to play a script of user actions and take screen shots of the UI every step of the way.
  • And finally, we demonstrate how this form of testing compares with the XCUITest framework that Apple gives us.

If you find any of this interesting, hop on over to our 100% free episode demonstrating how all of this (and more) is possible!


Free Video: Testing SwiftUI

Wednesday Dec 18, 2019

This past WWDC, Apple introduced SwiftUI, a rethinking of how to build UI on Apple’s platforms. It allows us to think of our views in a declarative manner so that we can simply describe the view hierarchy rather than think about all the messy details of how to coordinate various objects to get UI on the screen.

Even though it’s early days, Apple has given us a ton of guidance on how to use this technology, including an in-depth collection of tutorials, but one thing that’s still missing is how to test SwiftUI.

This week we explore just that in a free video! We explore what it means to test SwiftUI logic and its various state management solutions, including @Binding, @ObservedObject, and @State. Click here to watch it today!

If you’re interested in learning even more about SwiftUI and Combine, check out our other free videos.


Older blog posts

Wednesday Nov 20, 2019

A Crash Course in Combine

Two free videos exploring Apple's new Combine framework, its core components, and how to integrate it in your code.

Thursday Nov 7, 2019

Higher-Order Snapshot Testing

How to enrich snapshot testing strategies with additional behavior using higher-order constructions.

Tuesday Jul 30, 2019

SwiftUI and State Management Corrections

Xcode 11 beta 5 has brought lots of changes to SwiftUI, and we'd like to take a moment to provide corrections to our episodes based on these changes.

Thursday May 9, 2019

Enterprise Subscriptions

Point-Free now supports enterprise subscriptions, making it easier than ever to manage a team subscription for larger organizations! For a fixed yearly rate, everyone with an email from your company's domain will get instant access to everything Point-Free has to offer. Contact us for more info!

Monday Apr 29, 2019

Open Sourcing Enum Properties

We wanted to make Swift enum data access as ergonomic as struct data access, so today we are open sourcing a code generation tool to do just that!

Monday Mar 18, 2019

Open Sourcing Gen

Today we are open sourcing Gen: a lightweight wrapper around Swift's randomness API's that makes randomess more composable, transformable and controllable!

Tuesday Jan 8, 2019

Announcing swift-html 0.2.0

Announcing swift-html 0.2.0: support for CocoaPods, Carthage, SnapshotTesting, and more!

Wednesday Dec 19, 2018

2018 Year-in-Review

41 episodes, 19 hours of video, 25 blog posts, 8 open source libraries, 3.8K stars, 36K visitors, and we’re just getting started?

Monday Dec 3, 2018

SnapshotTesting 1.0: Delightful Swift snapshot testing

Today we are open sourcing SnapshotTesting 1.0: a modern, composable snapshot testing library built entirely in Swift!

Monday Oct 29, 2018

Some news about contramap

We've seen that contramap is a powerful operation, but the name isn't fantastic. We propose a much more intuitive name for this operation, and in doing so make our code much easier to read.

Tuesday Oct 9, 2018

How to Control the World

APIs that interact with the outside world are unpredictable and make it difficult to test and simulate code paths in our apps. Existing solutions to this problem are verbose and complicated, so let's explore a simpler solution by embracing singletons and global mutation, and rejecting protocol-oriented programming and dependency injection.

Monday Oct 8, 2018

Watch episodes in your favorite podcast app!

Follow along with the newest Point-Free episodes using your favorite podcast app. We now support podcast-friendly RSS feeds for viewing all of our videos.

Thursday Sep 20, 2018

Random Zalgo Generator

Let's create a random Zalgo text generator using the simple Gen type we defined in this week's episode!

Thursday Sep 13, 2018

Type-safe HTML with Kitura

Today we're releasing a Kitura plug-in for rendering type-safe HTML. It provides a Swift compile-time API to HTML that prevents many of the runtime errors and vulnerabilities of traditional templated HTML rendering.

Thursday Sep 13, 2018

Type-safe HTML with Vapor

Today we're releasing a Vapor plug-in for rendering type-safe HTML. It provides a Swift compile-time API to HTML that prevents many of the runtime errors and vulnerabilities of traditional templated HTML rendering.

Wednesday Sep 12, 2018

Open sourcing swift-html: A Type-Safe Alternative to Templating Languages in Swift

Today we are open sourcing a new library for building HTML documents in Swift. It's extensible, transformable, type-safe, and provides many benefits over templating languages.

Friday Aug 17, 2018

Overture 0.3.0: Now with Zip

Today we are releasing Overture 0.3.0 with a bunch of useful zip functions.

Friday Aug 17, 2018

Open Sourcing Validated

Today we are open sourcing Validated, a tiny functional Swift library for handling multiple errors: functionality that you don't get from throwing functions and the Result type.

Thursday Aug 16, 2018

Solutions to Exercises: Zip Part 3

Today we solve the exercises to the third and final part of our introductory series on zip.

Wednesday Aug 15, 2018

Solutions to Exercises: Zip Part 2

Today we solve the exercises to the second part of our introductory series on zip.

Tuesday Aug 14, 2018

Solutions to Exercises: Zip Part 1

Today we solve the exercises to the first part of our introductory series on zip.

Monday Aug 6, 2018

Announcing Student Discounts

Get 50% off your Point-Free subscription with proof of enrollment at a university or coding school.

Monday Jul 30, 2018

Celebrating 6 Months

This week marks 6 months since our launch, and we’re making one of our most popular episodes free to the public!

Monday Jul 2, 2018

Conditional Coding

What happens when we combine Swift's conditional conformance with codability?

Monday Jun 25, 2018

Open Sourcing NonEmpty

Today we are open sourcing NonEmpty, a Swift library for modeling non-empty collection types. This small library can help make your code safer and more expressive with very little work.

Monday Jun 18, 2018

Tagged Seconds and Milliseconds

Let's create a type-safe interface for dealing with seconds and milliseconds in our programs. We'll use the `Tagged` type, which allows us to construct all new types in a lightweight way.

Wednesday May 30, 2018

Styling with Functions: Free for Everyone!

We are making one of our early episodes, “UIKit Styling with Functions”, free to everyone today! It’s a seminal episode that sets the foundation for some later work in the Point-Free series.

Tuesday May 15, 2018

Overture: Now with Functional Setters

Announcing Overture 0.2.0! This release is all about setters: functions that allow us to build complex transformations out of smaller units.

Monday May 7, 2018

Solutions to Exercises: Contravariance

This week we solve the exercises from our episode on contravariance, because there were _a lot_ of them!

Monday Apr 23, 2018

Case Study: Algebraic Data Types

Let’s look at a real world use for algebraic data types. We will refactor a data type that is used in the code on this very site so that the invalid states are unrepresentable by the compiler.

Monday Apr 23, 2018

Announcing Point-Free Pointers!

Today we are excited to announcement launch of Point-Free Pointers, a blog to supplement our video series for all the content we couldn’t fit in. Expect to find regularly postings here that dive even deeper into functional programming, showing real world use cases and more!