Skip to content
@swift-primitives

Swift Primitives

Atomic building blocks for Swift — Layer 1 of the Swift Institute ecosystem.

Swift Primitives

Atomic building blocks for Swift — Layer 1 of the Swift Institute ecosystem.

What this is

Small, composable packages that each model a single domain: buffer, memory, time, geometry, parsing, rendering, async coordination, and many more. Layer 1 depends on nothing outside the Swift standard library — every package is Foundation-free, strictly memory-safe, ~Copyable-aware, and uses typed throws. Everything in the higher layers of the ecosystem composes against these packages.

Start here

Package What it gives you
swift-tagged-primitives Phantom-typed value wrappers for zero-cost type safety
swift-async-primitives Raw async coordination — Channel, Broadcast, Semaphore, Mutex, Barrier, Promise — with ~Copyable support and typed-throws cancellation
swift-memory-allocation-primitives Allocators that carve a memory region into slots — passthrough System, bump Arena, O(1) fixed-size Pool
swift-builder-primitives A shared, macro-free result-builder grammar for declarative element collection
swift-buffer-primitives Buffer types for working with contiguous memory
swift-render-primitives The core render abstractions behind the ecosystem's HTML, SVG, and PDF output

Browse everything

The repositories tab lists every package with its description. Narrow it down:

buffer · memory · time · geometry · parser · render · async · machine

Packages are ordered in dependency tiers — Tier 0 depends only on the standard library; higher tiers compose lower ones. The full ordering is documented in Primitives Tiers.

Conventions

Every package in this organization adheres to a shared set of conventions:

  • Nest.Name naming — no compound type names; File.Directory.Walk, never FileDirectoryWalk.
  • Typed throws end-to-endthrows(Domain.Error), not any Error.
  • One type per file — predictable navigation, minimal merge conflicts.
  • ~Copyable by default — types opt into Copyable, not out of it.
  • ~Escapable for views — pointer-based views cannot outlive their base.
  • Foundation-free — no import Foundation anywhere in Layer 1.
  • Strict memory safety — enabled on every target; every unsafe-pointer site carries explicit unsafe vocabulary.
  • Multi-target per package — Core + variants + umbrella; import the narrow variant you need.

Each package ships with a DocC catalog documenting these at type granularity.

How to use a package

Each package is a separate Swift Package Manager package with its own repository — add the one you need directly:

dependencies: [
    .package(url: "https://github.com/swift-primitives/swift-tagged-primitives.git", from: "0.1.0")
]

See each package's README for current products, platforms, and umbrella-vs-variant choices.

Status

Public alpha — packages are stabilising toward a first coordinated milestone.

Maintained by Coen ten Thije Boonkkamp — contributions welcome via pull request.

License

All packages in this organization use the Apache License 2.0.

Pinned Loading

  1. swift-async-primitives swift-async-primitives Public

    Raw async coordination primitives (Channel/Broadcast/Semaphore/Mutex/Barrier/Promise/Bridge) a layer below AsyncSequence, with ~Copyable element support and typed-throws cancellation.

    Swift 1

  2. swift-parser-primitives swift-parser-primitives Public

    Byte-oriented parser combinators split into narrow, independently importable modules for Swift.

    Swift 1

  3. swift-standard-library-extensions swift-standard-library-extensions Public

    Typed-throws overloads for rethrows-erased stdlib closures, result-builder DSLs for collection types, and safe-indexing accessors for Swift.

    Swift

  4. swift-bit-primitives swift-bit-primitives Public

    Bit types for Swift.

    Swift

  5. swift-byte-primitives swift-byte-primitives Public

    Byte type for Swift — atomic binary data unit distinct from UInt8, with bitwise ops, hex accessor, and Carrier.Protocol conformance.

    Swift

  6. swift-binary-primitives swift-binary-primitives Public

    Binary types for Swift.

    Swift

Repositories

Showing 10 of 196 repositories

People

This organization has no public members. You must be a member to see who’s a part of this organization.

Top languages

Loading…

Most used topics

Loading…