Skip to content

Commit

Permalink
[DOC][FIX] Solves #1709, #1728, #1748, #1737 and #1749.
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrofsn committed Feb 25, 2024
1 parent 1e501c4 commit c004609
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
6 changes: 3 additions & 3 deletions docs/reference/koin-android/get-instances.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ override fun onCreate(savedInstanceState: Bundle?) {
```

:::info
if you class doesn't have extensions, just add KoinComponent interface If you need to `inject()` or `get()` an instance from another class.
if your class doesn't have extensions, just implement the `KoinComponent` interface in it to `inject()` or `get()` an instance from another class.
:::

## Using the Android Context in a Definition

Once your `Application` class you can use `androidContext` function:
Once your `Application` class configures Koin you can use the `androidContext` function to inject Android Context so that it can be resolved later when you need it in modules:

```kotlin
class MainApplication : Application() {
Expand All @@ -62,7 +62,7 @@ class MainApplication : Application() {
super.onCreate()

startKoin {
//inject Android context
// inject Android context
androidContext(this@MainApplication)
// ...
}
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/koin-android/modules-android.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ By using Koin, you describe definitions in modules. In this section we will see

## Using several modules

Components doesn't have to be necessarily in the same module. A module is a logical space to help you organize your definitions, and can depend on definitions from other
module. Definitions are lazy, and then are resolved only when a component is requesting it.
Components don't have to be necessarily in the same module. A module is a logical space to help you organize your definitions, and can depend on definitions from another
module. Definitions are lazy, and they are resolved only when a component requests them.

Let's take an example, with linked components in separate modules:

Expand Down
10 changes: 4 additions & 6 deletions docs/reference/koin-android/start.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Start Koin on Android
---

The `koin-android` project is dedicated to provide Koin powers to Android world. See the [Android setup](../../setup/v3.2#android) section for more details.
The `koin-android` project is dedicated to provide Koin powers to Android world. See the [Android setup](../../setup/koin#android) section for more details.

## From your Application class

Expand All @@ -22,13 +22,12 @@ class MainApplication : Application() {
// Load modules
modules(myAppModules)
}

}
}
```

:::info
You can also start Koin from anywhere if you don't ant to start it from your Application class.
You can also start Koin from anywhere if you don't want to start it from your Application class.
:::

If you need to start Koin from another Android class, you can use the `startKoin` function and provide your Android `Context`
Expand All @@ -48,7 +47,7 @@ From your Koin configuration (in `startKoin { }` block code), you can also confi

### Koin Logging for Android

Within your `KoinApplication` instance, we have an extension `androidLogger` which use the `AndroidLogger()`#
Within your `KoinApplication` instance, we have an extension `androidLogger` which uses the `AndroidLogger()` class.
This logger is an Android implementation of the Koin logger.

Up to you to change this logger if it doesn't suit to your needs.
Expand All @@ -69,8 +68,7 @@ You can use Koin properties in the `assets/koin.properties` file, to store keys/
startKoin {
// ...
// use properties from assets/koin.properties
androidFileProperties()

androidFileProperties()
}
```

8 changes: 4 additions & 4 deletions docs/reference/koin-core/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ fun sharedModule() = module {
}
```

This way, your share the definitions and avoid preallocate factories in a value.
This way, you share the definitions and avoid preallocating factories in a value.

## Overriding definition or module (before 3.1.0)

Expand Down Expand Up @@ -253,12 +253,12 @@ startKoin { modules(featureModule1, featureModule2) }
Notice that all modules will be included only once: `dataModule`, `domainModule`, `featureModule1`, `featureModule2`.

:::info
If you have any compiling issue while including modules from the same file, either use `get()` Kotlin attribute operator on your module either separate each module in files. See https://github.com/InsertKoinIO/koin/issues/1341 workaround
If you have any compiling issue while including modules from the same file, either use `get()` Kotlin attribute operator on your module or separate each module in files. See https://github.com/InsertKoinIO/koin/issues/1341 workaround
:::

## Lazy modules & background modules loading with Kotlin coroutines [Experimental]

You can now declare "lazy" Koin module, to avoid trigger any pre allocation of resources and load them in background with Koin start.
You can now declare a "lazy" Koin module, to avoid triggering any pre allocation of resources and load them in background with Koin start.

- `lazyModule` - declare a Lazy Kotlin version of Koin Module
- `Module.includes` - allow to include lazy Modules
Expand Down Expand Up @@ -294,4 +294,4 @@ koin.waitAllStartJobs()
koin.runOnKoinStarted { koin ->
// run after background load complete
}
```
```

0 comments on commit c004609

Please sign in to comment.