Agent-skills-standard ios-dependency-injection
Configure protocol-based DI with property wrappers and Factory/Swinject. Use when setting up dependency injection or factory patterns in iOS. (triggers: **/*.swift, @Injected, Resolver, Container, Swinject, register, resolve)
install
source · Clone the upstream repo
git clone https://github.com/HoangNguyen0403/agent-skills-standard
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/HoangNguyen0403/agent-skills-standard "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/ios/ios-dependency-injection" ~/.claude/skills/hoangnguyen0403-agent-skills-standard-ios-dependency-injection && rm -rf "$T"
manifest:
skills/ios/ios-dependency-injection/SKILL.mdsource content
iOS Dependency Injection
Priority: P0
Implementation Workflow
- Prefer initializer injection — Pass dependencies through
as primary approach.init - Inject protocols — Always depend on protocols instead of concrete classes for testability.
- Choose DI library — Use
for lightweight DI,Factory
for enterprise-grade container-based projects.Swinject - Apply correct scoping — Singleton for app-wide services (Auth, Network); Unique/Transient for ViewModels; Graph/Cached for feature flows.
See protocol-based DI and Factory registration examples
Anti-Patterns
- No Global Singletons: Inject services via initializer
- No Inline Service Resolution: Pass dependencies via constructor; avoid
in business logicResolver.resolve() - No Concrete Class Dependencies: Depend on protocols for testability