Point-Free Episode Code Samples

repository·main·Indexed 21 days ago

https://github.com/pointfreeco/episode-code-samples

A collection of Swift code samples from the Point-Free video series. The repository covers advanced functional programming, SwiftUI, The Composable Architecture, and modern iOS development patterns, including topics such as Algebraic Data Types, Higher-Order Functions, Key Paths, Dependency Injection, and Domain Specific Languages.

Tokens
139.3K
Snippets
278
Records
616
Agent score
68%

What's inside pointfreeco-episode-code-samples

  1. Introduction to swift-parsing

    main

    swift-parsing is a Swift library designed for transforming nebulous data into well-structured data. It focuses on four key pillars:

    • Composition: Breaking complex parsing problems into smaller, simpler ones and combining simple parsers into complex ones.
    • Performance: Composed parsers are designed to perform as well as highly-tuned, hand-written parsers.
    • Generality: Ability to parse any kind of input (e.g., String, Substring, UTF8View, Array) into any kind of output.
    • Ergonomics: A simple, fluent API to describe parsing problems succinctly.
  2. Overview of Persistence Callbacks: Advanced Triggers

    main

    This directory contains the code samples for the Point-Free episode: Persistence Callbacks: Advanced Triggers.

    The samples demonstrate how to call back to Swift from a database trigger. This technique is used to improve the ergonomics of specific features within a Reminders application, specifically focusing on modern persistence patterns and advanced callback triggers.

  3. Overview of Redacted SwiftUI Part 2 code samples

    main

    This directory contains the implementation details for the Point-Free episode: The Point of Redacted SwiftUI: Part 2.

    The code demonstrates how to build a rich onboarding experience by selectively enabling and disabling application logic based on the current onboarding step. This implementation relies on the strict 'separation of concerns' provided by The Composable Architecture (TCA) to manage state and logic transitions during the onboarding process.

  4. Overview of Observable Architecture: Observing Enums

    main
    This sample code demonstrates an evolution in The Composable Architecture (TCA) where structs and optionals are made observable. This advancement eliminates the requirement for ViewStore and IfLetStore. The specific focus of this episode is making enums observable, which aims to eliminate the need for SwitchStore and improve the ergonomics of working with enums within the library.
  5. Overview of Witness-Oriented Library Design

    main

    This directory contains the code samples from the Point-Free episode Witness-Oriented Library Design: Part 2.

    The samples demonstrate a refactoring technique where protocols are replaced with concrete datatypes to achieve greater flexibility and extensibility in library design. This approach follows the learnings established in the first part of the series regarding how to design libraries that are easier to extend without the overhead or limitations of protocol-based abstractions.

  6. Overview of Derived Behavior: The Point episode

    main

    This directory contains the code samples from the Point-Free episode Derived Behavior: The Point.

    The samples demonstrate a reverse architectural approach: instead of the typical pattern of migrating vanilla SwiftUI applications to The Composable Architecture (TCA), this episode explores "deriving behavior" by taking an existing TCA application and rewriting it using only native SwiftUI tools provided by Apple.

  7. Overview of Sharing with SQLite: Dynamic Queries

    main

    This directory contains the code samples for the Point-Free episode Sharing with SQLite: Dynamic Queries.

    The implementation demonstrates how to drive application features using SQLite via a custom property wrapper. This property wrapper is designed to provide ergonomics similar to SwiftData's @Query macro, automatically synchronizing views with the underlying database state. The specific focus of this sample is leveraging dynamic queries to allow users to change data sorting at runtime.

  8. Overview of SQL Builders: Advanced Selects

    main

    This directory contains the implementation of a type-safe SQL builder demonstrated in the Point-Free episode SQL Builders: Advanced Selects.

    While previous iterations of the builder used key paths to generate SELECT statements, this version introduces an advanced syntax leveraging variadic generics. This allows for more complex query expressions and improved type safety when constructing SQL queries.

  9. Overview of CloudKit Sync: The SyncEngine code samples

    main

    This directory contains the implementation samples for the Point-Free episode: CloudKit Sync: The SyncEngine.

    The code demonstrates how a SyncEngine manages data synchronization with iCloud, including:

    • Seamlessly synchronizing data to and from iCloud.
    • Resolving conflicts when records are edited or deleted across multiple devices.
    • Synchronizing records between different versions of an application and different database schemas.
  10. Overview of Async Composable Architecture: Streams

    main
    This sample code demonstrates how to extend the Effect type in The Composable Architecture (TCA) to support sending multiple actions back into the system using an asynchronous context. By leveraging Swift's structured concurrency, you can create complex effects that emit a stream of actions in a natural way while maintaining full testability.
  11. Overview of Composable Navigation: Unification

    main

    This directory contains the code samples from the Point-Free episode Composable Navigation: Unification.

    The goal of this implementation is to unify various navigation APIs used for driving alerts, dialogs, and sheets into a single, cohesive package. This unified approach allows the same navigation logic to be applied across different presentation styles, including popovers and fullscreen covers.