Skip to content

Gator is tiny DI lib. Koin syntax. Toothpick scope model

Notifications You must be signed in to change notification settings

terekhovyes/gator

Repository files navigation

Gator

Gator is tiny DI lib. Koin syntax. Toothpick scope model

Installation

Root build.gradle file:

allprojects {
    repositories {
	maven { url 'https://jitpack.io' }

App build.gradle file:

dependencies {
    implementation 'com.github.terekhovyes:gator:0.1.0'

Example

class Person(val name: String)

class GreetingPrinter(val person: Person) {
    fun print() = println("Hello, ${person.name}!")
}

Gator.scope(application) {
    include {
        factory { GreetingPrinter(instance()) }
    }
}

val screenScope = Gator.scope(application, screen) {
    include {
        single { Person("Gator") }
    }
}

val greetingPrinter = screenScope.instance<GreetingPrinter>()
greetingPrinter.print() // "Hello, Gator!"

About

Gator is tiny DI lib. Koin syntax. Toothpick scope model

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages