Latest 0.0.2
Homepage https://github.com/tomersh/Train
License NetBSD
Platforms ios
Authors

Train has evolved!

Train has grew up and it is now AppleGuice.
AppleGuice is a fully featured, high performance dependency injection framework.
It is based on Train’s core feature and concept but 10x better.

A simple dependency injection framework for objective c, written while traveling in a train!

Usage

Add an Ivar to your Class file with the IOC prefix and the service you want to inject.
There are three injection flavours:

// .m
@interface MyClass () {
    MyService* _ioc_MyService; //will create an instance of MyService.
    id<MyProtocol> _ioc_MyProtocol //will create an instance of the first class conforming to MyProtocol.
    NSArray* _ioc_MyProtocol //will return an array containing instances of all classes conforming to MyProtocol
}

Use the service in your class. It is already initialized!

How to install

Copy the src folder to your project directory

-OR-

pod 'Train'

In your AppDelegate, add the following:

#import "AutoInjector.h"

+(void)initialize {
    [AutoInjector autoInjectIoc];
}

Thats its, your all set and ready to go.

Sample project

Check it out!

Latest podspec

{
    "name": "Train",
    "version": "0.0.2",
    "summary": "A simple dependency injection framework for objective c, written while traveling in a train.",
    "homepage": "https://github.com/tomersh/Train",
    "authors": {
        "Tomer Shiri": "[email protected]"
    },
    "source": {
        "git": "https://github.com/tomersh/Train.git",
        "tag": "v0.0.2"
    },
    "platforms": {
        "ios": null
    },
    "source_files": "src/*",
    "requires_arc": false,
    "license": {
        "type": "NetBSD",
        "file": "LICENSE"
    }
}

Pin It on Pinterest

Share This