hmlongcohmlongcoCommunityยท2 Agent Skills Included

Factory

Compile-time safe dependency injection for Swift and SwiftUI apps

Guides AI agents through Factory, a container-based dependency injection library for Swift and SwiftUI. Covers factory registrations, property wrappers, scopes, contexts, mocking, and parallel-safe unit testing. Eliminates manual wiring errors, retain cycles, and boilerplate when building modular iOS and macOS apps.
npx skills add hmlongco/Factory --all -g -y
Available:

Orients the AI agent to the Factory codebase and routes it to the factory-dependency-injection skill whenever it touches FactoryKit registrations, containers, or property wrappers.

All Skills in This Repository (2)

Pure Emerald Level Indicators

Frequently Asked Questions

FAQPage Schema
How to install Factory?โ–ผ

Run `npx skills add hmlongco/Factory --all -g -y` in your terminal to install all skills in this suite globally.

What is Factory for Swift?โ–ผ

Factory is a lightweight, compile-time safe dependency injection library for Swift and SwiftUI. It lets you register and resolve services through containers with a single line of code.

How do I mock dependencies in Swift tests with Factory?โ–ผ

Register a mock closure on the container's factory, such as `Container.shared.myService.register { MockService() }`. The FactoryTesting trait gives each Swift Testing test an isolated container automatically.

Does Factory work with SwiftUI and @Observable?โ–ผ

Yes. Factory provides `@InjectedObject` for ObservableObject view models and `@InjectedObservable` for iOS 17+ @Observable types, plus preview modifiers for swapping in mocks.

How is Factory different from Swinject or Needle?โ–ผ

Factory needs no code generation, build phases, or upfront type registration. Each dependency is a computed property on a container, so missing registrations fail at compile time instead of runtime.

Related Repositories in Software Engineering

View All in Software Engineeringโ†’