# uber/needle

Compile-time safe Swift dependency injection framework

Repository: https://github.com/uber/needle
Canonical: https://ross.abutalabs.com/products/uber-needle
Language: Swift
License: Apache-2.0
License Family: permissive
Last push: 2026-04-29T19:41:58+00:00

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

## Adoption (not part of the score)
Stars 2014, forks 162 (observed 2026-08-28T04:06:05.444424+00:00)

## What it is
Needle is a compile-time safe dependency injection framework for Swift, inspired by Dagger for the JVM. It uses hierarchical DI scopes and code generation so that dependency injection errors are caught at compile time rather than at runtime.

## Use cases
- inject dependencies into an iOS app with compile-time safety
- replace runtime DI crashes with build-time verification
- structure dependency injection hierarchically in a large Swift codebase
- use DI with RIBs or MVx architectures in Swift
- generate DI boilerplate code for multi-million-line Swift projects

## When to choose
- you build iOS apps in Swift and want Dagger-like compile-time safe DI
- your codebase is large and runtime DI failures are costly
- you use Uber's RIBs architecture or hierarchical DI patterns

## When to avoid
- you need DI for server-side Swift or non-Apple platforms
- you prefer lightweight runtime DI containers like Swinject
- your project is small and manual DI is sufficient

## Facets
- artifact type: framework
- maturity: active
- function: developer-tools
- domain: developer-tools, mobile-development
- platform: -
- tags: dependency-injection, compile-time-safety, code-generation, swift, ios, dagger-like, macos

## Member repositories
- uber/needle (main) score 58

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:06:05.444424+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:00:51.066943+00:00, confidence not recorded.
  - readme: https://github.com/uber/needle (fetched 2026-08-28T04:06:05.444424+00:00, sha 5896aa4fd486)
- Data as of 2026-08-30T08:39:29.467469+00:00.
