Skip to content
Back to skills

Ios Dependency Injection

ASecurity

Configure protocol-based DI with property wrappers and Factory/Swinject. Use when setting up dependency injection or factory patterns in iOS.

  • 549 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added June 6, 2026
developmentswift

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned June 6, 2026

npx -y skills add HoangNguyen0403/agent-skills-standard --skill ios-dependency-injection --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Ios Dependency Injection?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Ios Dependency Injection
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/hoangnguyen0403-ios-dependency-injection/badge)](https://www.skillsdirectory.com/skills/hoangnguyen0403-ios-dependency-injection)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: ios-dependency-injection
description: Configure protocol-based DI with property wrappers and Factory/Swinject. Use when setting up dependency injection or factory patterns in iOS.
metadata:
  triggers:
    files:
    - '**/*.swift'
    keywords:
    - "@Injected"
    - Resolver
    - Container
    - Swinject
    - register
    - resolve
---
# iOS Dependency Injection

## **Priority: P0**

## 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](references/implementation.md)

## Anti-Patterns

- **No Global Singletons**: Inject services via initializer
- **No Inline Service Resolution**: Pass dependencies via constructor; avoid `Resolver.resolve()` in business logic
- **No Concrete Class Dependencies**: Depend on protocols for testability

## References

- [Manual & Library DI Setup](references/implementation.md)

Files in this skill

  • SKILL.md1.3 KB
  • evals/evals.json1.7 KB
  • references/implementation.md1.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.