swift-factory-di

Installation
SKILL.md

Factory DI — Reference & Optimization Guide

Based on Factory 2.5.3 by Michael Long (hmlongco) — a compile-time safe, container-based dependency injection framework for Swift.

This skill is an unofficial community resource. Factory is licensed under the MIT License.

Factory is under 1000 lines of executable code, yet provides containers, scopes, contexts, decorators, parameter injection, and full SwiftUI integration. It requires no code generation, build scripts, or runtime reflection.

As of 2.5.0, the recommended import is import FactoryKit (not import Factory) to avoid SPM naming conflicts.


Core Patterns

Defining a Factory

Factories are computed properties on container extensions. Each returns a Factory<T> that wraps a closure producing the dependency:

Installs
4
Repository
guillevc/skills
First Seen
Mar 29, 2026
swift-factory-di — guillevc/skills