# pointfreeco/swift-tagged

🏷 A wrapper type for safer, expressive code.

Repository: https://github.com/pointfreeco/swift-tagged
Canonical: https://ross.abutalabs.com/products/swift-tagged
Homepage: https://www.pointfree.co/episodes/ep12-tagged
Language: Swift
License: MIT
License Family: permissive
Topics: swift, type-safety, tagged-types, conditional-conformance
Last push: 2025-11-14T19:04:47+00:00

## Health v2 (maintenance only)
Score: 46/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 52, release rhythm 8, longevity 100
- inputs: {"age_days": 3061, "days_push": 292, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1629, forks 74 (observed 2026-08-28T04:05:13.890787+00:00)

## What it is
A Swift library providing a Tagged wrapper type that distinguishes otherwise interchangeable raw values (like Int or String) at compile time. It leverages generics and conditional conformance to prevent runtime bugs caused by mixing semantically different values such as user IDs and subscription IDs.

## Use cases
- prevent mixing user IDs and subscription IDs in Swift
- wrap raw strings into domain-specific types like email addresses
- make invalid states unrepresentable at compile time
- add type safety to primitive-typed identifiers
- differentiate seconds from milliseconds at the type level

## When to choose
- you are writing Swift and want compile-time safety for primitive-based domain values
- your codebase has bugs from passing the wrong Int or String to functions
- you want a lightweight, zero-dependency newtype pattern

## When to avoid
- you are not working in Swift
- you need runtime-validated types (e.g. actual email format checking) rather than nominal distinction
- your team finds generic phantom-type wrappers too complex

## Facets
- artifact type: library
- maturity: stable
- function: type-system, developer-tools
- domain: programming-languages, developer-tools
- platform: cross-platform
- tags: tagged-types, type-safety, newtype, swift-package, conditional-conformance, algorithms, swift, ios, macos

## Member repositories
- pointfreeco/swift-tagged (main) score 46

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:13.890787+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:48:17.932685+00:00, confidence not recorded.
  - readme: https://github.com/pointfreeco/swift-tagged (fetched 2026-08-28T04:05:13.890787+00:00, sha 516f8d260516)
  - homepage: https://www.pointfree.co/episodes/ep12-tagged (fetched 2026-08-29T11:20:48.841249+00:00, sha c1b4de33992d)
  - site_page: https://www.pointfree.co/about (fetched 2026-08-29T11:20:48.853857+00:00, sha c3a02fbfb680)
  - site_page: https://www.pointfree.co/pricing (fetched 2026-08-29T11:20:48.850931+00:00, sha ce5cad867927)
- Data as of 2026-08-30T08:39:29.467469+00:00.
