Ios dependency injection

From HoangNguyen0403/agent-skills-standard · View interactive version

Ios dependency injection is an AI agent skill from the GitHub repository HoangNguyen0403/agent-skills-standard. Configure protocol-based DI with property wrappers and Factory/Swinject. Use when setting up dependency injection or factory patterns in iOS.

How to use this skill

Skill file

iOS Dependency Injection

**Priority: P0 (CRITICAL)**

Implementation Workflow

  1. Prefer initializer injection — Pass dependencies through init as primary approach.
  2. Inject protocols — Always depend on protocols instead of concrete classes for testability.
  3. Choose DI library — Use Factory for lightweight DI, Swinject for enterprise-grade container-based projects.
  4. 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

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.