Skip to content
Branch: master
Find file History


This is documentation for Swinject v2.x series. Documentation for v1.x is here.

Swinject is a lightweight dependency injection framework for Swift apps. It allows you to split your app into loosely-coupled components, which can then be maintained and tested more easily. Swinject supports pure Swift types, and is powered by the Swift generic type system and first class functions. This makes it syntactically elegant and simple to define the object dependencies for your app.

Table of Contents


  1. DI Container
  2. Injection Patterns
  3. Circular Dependencies
  4. Object Scopes
  5. Misc

Advanced Features

  1. Container Hierarchy
  2. Modularizing Service Registration (Assembly)
  3. Thread Safety


  1. SwinjectPropertyLoader: Loading property values from resources
  2. SwinjectStoryboard: Automatic dependency injection via Storyboard
  3. Swinject-CodeGen: Type-safe code generation of Container from a CSV/YAML file defining dependencies
  4. SwinjectAutoregistration: Automatic registration of services by leveraging the Swift Generics.
You can’t perform that action at this time.