koin-androidx-scope

Koin

License

License

GroupId

GroupId

co.touchlab
ArtifactId

ArtifactId

koin-androidx-scope
Last Version

Last Version

2.1.5-mp
Release Date

Release Date

Type

Type

aar
Description

Description

koin-androidx-scope
Koin
Project URL

Project URL

https://github.com/touchlab/koin
Source Code Management

Source Code Management

https://github.com/touchlab/koin

Download koin-androidx-scope

How to add to project

<!-- https://jarcasting.com/artifacts/co.touchlab/koin-androidx-scope/ -->
<dependency>
    <groupId>co.touchlab</groupId>
    <artifactId>koin-androidx-scope</artifactId>
    <version>2.1.5-mp</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/co.touchlab/koin-androidx-scope/
implementation 'co.touchlab:koin-androidx-scope:2.1.5-mp'
// https://jarcasting.com/artifacts/co.touchlab/koin-androidx-scope/
implementation ("co.touchlab:koin-androidx-scope:2.1.5-mp")
'co.touchlab:koin-androidx-scope:aar:2.1.5-mp'
<dependency org="co.touchlab" name="koin-androidx-scope" rev="2.1.5-mp">
  <artifact name="koin-androidx-scope" type="aar" />
</dependency>
@Grapes(
@Grab(group='co.touchlab', module='koin-androidx-scope', version='2.1.5-mp')
)
libraryDependencies += "co.touchlab" % "koin-androidx-scope" % "2.1.5-mp"
[co.touchlab/koin-androidx-scope "2.1.5-mp"]

Dependencies

compile (3)

Group / Artifact Type Version
co.touchlab : koin-android jar 2.1.5-mp
androidx.appcompat » appcompat jar 1.0.2
androidx.lifecycle » lifecycle-common jar 2.0.0

Project Modules

There are no modules declared in this project.

logo

What is KOIN?

A pragmatic lightweight dependency injection framework for Kotlin developers.

Written in pure Kotlin, using functional resolution only: no proxy, no code generation, no reflection.

Koin is a DSL, a light container and a pragmatic API

Official Website πŸ‘‰ https://insert-koin.io

Latest News 🌐

Getting Help πŸš’

Documentation:

Any question about Koin usage?

Articles, Videos & other resources πŸŽ‰

Online resources about Koin - Talking about Koin

Reporting issues πŸš‘

Found a bug or a problem on a specific feature? Open an issue on Github issues

Contributing πŸ› 

Want to help or share a proposal about Koin? problem on a specific feature?

  • Open an issue to explain the issue you want to solve Open an issue
  • Come talk on slack #koin-dev channel
  • After discussion to validate your ideas, you can open a PR or even a draft PR if the contribution is a big one Current PRs

Additional readings about basic setup: https://github.com/InsertKoinIO/koin/blob/master/CONTRIBUTING.adoc

Setup

Current Version

// latest stable
koin_version = '2.1.0'

Gradle

Jcenter

Check that you have the jcenter repository.

// Add Jcenter to your repositories if needed
repositories {
	jcenter()    
}

Dependencies

Pick one of your Koin dependency:

Gradle Plugin

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath "org.koin:koin-gradle-plugin:$koin_version"
    }
}

apply plugin: 'koin'

Core features

// Koin for Kotlin
implementation "org.koin:koin-core:$koin_version"
// Koin extended & experimental features
implementation "org.koin:koin-core-ext:$koin_version"
// Koin for Unit tests
testImplementation "org.koin:koin-test:$koin_version"
// Koin for Java developers
implementation "org.koin:koin-java:$koin_version"

Android

// Koin for Android
implementation "org.koin:koin-android:$koin_version"
// Koin Android Scope features
implementation "org.koin:koin-android-scope:$koin_version"
// Koin Android ViewModel features
implementation "org.koin:koin-android-viewmodel:$koin_version"
// Koin Android Experimental features
implementation "org.koin:koin-android-ext:$koin_version"

AndroidX

// Koin AndroidX Scope features
implementation "org.koin:koin-androidx-scope:$koin_version"
// Koin AndroidX ViewModel features
implementation "org.koin:koin-androidx-viewmodel:$koin_version"
// Koin AndroidX Fragment features
implementation "org.koin:koin-androidx-fragment:$koin_version"
// Koin AndroidX Experimental features
implementation "org.koin:koin-androidx-ext:$koin_version"

Ktor

// Koin for Ktor Kotlin
implementation "org.koin:koin-ktor:$koin_version"

Quickstart

Declare a Koin module

Write with the Koin DSL what you need to assemble:

// Given some classes 
class Controller(val service : BusinessService) 
class BusinessService() 

// just declare it 
val myModule = module { 
  single { Controller(get()) } 
  single { BusinessService() } 
} 

Starting Koin

Use the startKoin() function to start Koin in your application.

In a Kotlin app:

fun main(vararg args : String) { 
  // start Koin!
  startKoin {
    // your modules
    modules(myModule)
  }
} 

In an Android app:

class MyApplication : Application() {
  override fun onCreate(){
    super.onCreate()
    // start Koin!
    startKoin {
      // Android context
      androidContext(this@MyApplication)
      // modules
      modules(myModule)
    }
  } 
} 

Talking about Koin

Articles

Videos & Podcasts

Koin Developers Hub

Contributors

This project exists thanks to all the people who contribute. [Contribute].

OpenCollective

Backers on Open Collective Sponsors on Open Collective

Backers

Thank you to all our backers! πŸ™ [Become a backer]

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

co.touchlab

Touchlab

Versions

Version
2.1.5-mp
2.1.4-mp