Latest 0.0.2
Homepage https://github.com/will3/AppInjector
License MIT
Platforms ios 8.0, requires ARC
Frameworks Foundation
Authors

App Injector

Usage

import AppInjector

class Car: NSObject {
    var name = ""
    var engine: Engine?
}

class Engine: NSObject { }

...

// Use Injector.defaultInjector or manage own life cycle
let injector = Injector()

// Inject via factory
injector.bind("engine") { Engine() }

// Inject constant
injector.bind("name", value: "private")

// Inject via NSObject constructor, and properties
injector.bind("car", type: Car.self).withDependencies(["name", "engine"])

// Resolve a car instance, all dependencies injected
let car = injector.resolve(Car.self)

assert(car.engine != nil)
assert(car.name == "private")

Installation

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

use_frameworks!
pod "AppInjector"

Latest podspec

{
    "name": "AppInjector",
    "version": "0.0.2",
    "summary": "Light weight injector",
    "homepage": "https://github.com/will3/AppInjector",
    "license": "MIT",
    "authors": {
        "Will Zhou": "[email protected]"
    },
    "social_media_url": "http://twitter.com/will3_z",
    "source": {
        "git": "https://github.com/will3/AppInjector.git",
        "tag": "0.0.2"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "AppInjector/**/*.{swift}",
    "frameworks": "Foundation"
}

Pin It on Pinterest

Share This