Latest 1.1.0
License MIT
Platforms ios 8.0

CI Status


To run the example project, clone the repo, and run pod install from the Example directory first.



SwiftDependencyInjection is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "SwiftDependencyInjection"



SwiftDependencyInjection is available under the MIT license. See the LICENSE file for more info.


1) Implement a module:

import SwiftDependencyInjection

protocol FooProvider {
    var foo: Foo { get }

final class FooModule: Module, FooProvider {
    weak var delegate: ModuleDelegate?

    lazy var foo: Foo = {
        return Foo()

Use a protocol (here FooProvider) to help to communicate and request injection types.

2) Requesting the implementations of the protocol (e.g. in your ViewController or in any other module):


This helps the injector to provide you the required dependencies. Add .with(…Provider.self) to request more dependencies.

3) Implement the Injectable protocol:

func inject<T>(inject: T) {
    if let inject = inject as? FooProvider {
        foo =

More samples are comming soon

Since we also have implemented some cyclomatic complexity, we’ll come back to you soon with an excample of how to use
Stay tuned!

Latest podspec

    "name": "SwiftDependencyInjection",
    "version": "1.1.0",
    "summary": "A dependency Injection Framework in Swift",
    "description": "Have you ever struggled withe dependency injection framework in swift. Here is one, that's based on dagger. You have modules, you have injectors that provides you with the modules, you require in your code. We also did some dependency resolving in our modules. Now let's get swifty.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "": ""
    "source": {
        "git": "",
        "tag": "1.1.0"
    "platforms": {
        "ios": "8.0"
    "source_files": "SwiftDependencyInjection/Classes/**/*",
    "pushed_with_swift_version": "3.0"

Pin It on Pinterest

Share This