Skip to content

thedoritos/minject

Repository files navigation

Minject

CI Status Version License Platform

Minject is a minimum Dependency Injection framework for Swift.

It is designed for developers to avoid depending on "magical" behavior and have explicit control by self.

Example

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

Minimum DI

What you can do with Minject is simple. Register dependencies into the container and resolve when you need an instance.

let diContainer = DIContainer()
    .register(TodoRepository.self, TodoRepositoryImpl.shared)
    .register(TodoPresenter.self) { TodoPresenter(todoRepository: $0.resolve()) }

let repository: TodoRepository = diContainer.resolve()
let presenter: TodoPresenter = diContainer.resolve()

Requirements

See Minject.podspec file for more info.

Installation

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

pod 'Minject'

Author

Tomohiro Matsumura, thedoritos@gmail.com

License

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