# hpique/SwiftSingleton

An exploration of the Singleton pattern in Swift

Repository: https://github.com/hpique/SwiftSingleton
Canonical: https://ross.abutalabs.com/products/swiftsingleton
Language: Swift
License: Apache-2.0
License Family: permissive
Last push: 2016-11-05T18:02:48+00:00

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

## Adoption (not part of the score)
Stars 1127, forks 101 (observed 2026-08-28T04:03:41.401212+00:00)

## What it is
An educational repository exploring different implementations of the Singleton pattern in Swift, comparing class constant, nested struct, and dispatch_once approaches. It demonstrates lazy initialization and thread safety trade-offs across Swift versions.

## Use cases
- how to implement a singleton in Swift
- thread-safe singleton Swift example
- lazy initialization singleton pattern Swift
- Swift 1.2 static let singleton
- dispatch_once singleton in Swift
- nested struct singleton workaround

## When to choose
- learning how the Singleton pattern works in Swift
- comparing historical Swift singleton implementations
- teaching design patterns in Swift courses

## When to avoid
- production code on modern Swift versions where static let is standard
- needing up-to-date Swift concurrency patterns like actors
- looking for a maintained library rather than a reference example

## Facets
- artifact type: learning-resource
- maturity: abandoned
- function: developer-tools
- domain: developer-tools, tutorials, programming-languages
- platform: -
- tags: swift, singleton-pattern, design-patterns, educational, thread-safety, ios, macos

## Member repositories
- hpique/SwiftSingleton (main) score 32

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:03:41.401212+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-30T06:38:47.836089+00:00, confidence not recorded.
  - readme: https://github.com/hpique/SwiftSingleton (fetched 2026-08-28T04:03:41.401212+00:00, sha 4a8548a62e87)
- Data as of 2026-08-30T08:39:29.467469+00:00.
