Skip to content

Commit

Permalink
Merge pull request #1691 from bigman212/fix-typos-add-bom
Browse files Browse the repository at this point in the history
Documentation: Add bom installation module and fix typos
  • Loading branch information
arnaudgiuliani committed Nov 16, 2023
2 parents 4e96a28 + 27d40df commit a9da4c6
Show file tree
Hide file tree
Showing 14 changed files with 72 additions and 53 deletions.
2 changes: 1 addition & 1 deletion docs/reference/koin-android/dsl-update.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Koin now offer a new kind of DSL keyword that allow you to target a class constr

Check the new [Constructor DSL](../koin-core/dsl-update.md#constructor-dsl-since-32) section for more details.

For Android, this implies the following new constructore DSL Keyword:
For Android, this implies the following new constructor DSL Keyword:

* `viewModelOf()` - equivalent of `viewModel { }`
* `fragmentOf()` - equivalent of `fragment { }`
Expand Down
6 changes: 3 additions & 3 deletions docs/reference/koin-android/modules-android.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,15 @@ Notice that all modules will be included only once: `dataModule`, `domainModule`

## Reducing Startup time with background module loading

You can now declared "lazy" Koin module, to avoid trigger any pre allocation of resources and load them in background with Koin start. This can help avoid to block Android starting process, by passing lazy modules to be laoded in background.
You can now declared "lazy" Koin module, to avoid trigger any pre allocation of resources and load them in background with Koin start. This can help avoid to block Android starting process, by passing lazy modules to be loaded in background.

- `lazyModule` - declare a Lazy Kotlin version of Koin Module
- `Module.includes` - allow to include lazy Modules
- `KoinApplication.lazyModules` - load lazy modules in background with coroutines, regarding platform default Dispatchers
- `Koin.waitAllStartJobs` - wait for start jobs to complete
- `Koin.runOnKoinStarted` - run block code after start completion

A good example is always betetr to udnerstand:
A good example is always better to understand:

```kotlin

Expand All @@ -154,7 +154,7 @@ startKoin {

val koin = KoinPlatform.getKoin()

// wait for start completetion
// wait for start completion
koin.waitAllStartJobs()

// or run code after start
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/koin-android/viewmodel.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ ComponentActivity.viewModelForClass(
```

:::note
This function is still using `state: BundleDefinition`, but will comvert it to `CreationExtras`
This function is still using `state: BundleDefinition`, but will convert it to `CreationExtras`
:::

Note that you can have access to the top level function, callable from anywhere:
Expand Down
5 changes: 3 additions & 2 deletions docs/reference/koin-compose/compose.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Difference between `KoinAndroidContext` and `KoinContext`:

### Compose Preview with Koin

The `KoinApplication` function is also interesting to start dedicated context for preview. This can be also used to helo with Compose preview:
The `KoinApplication` function is also interesting to start dedicated context for preview. This can be also used to help with Compose preview:

```kotlin
@Composable
Expand All @@ -66,8 +66,9 @@ For a module that declares a 'MyService' component:

```kotlin
val androidModule = module {

single { MyService() }
// or constructor DSL
singleOf(::MyService)
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/koin-compose/isolated-context.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ With a Compose application, you can work the same way with an [isolated context]

## Define isolated context

First let's declare our isolated context holder, in order to store our isolated Koin isntance in memory. This can be done with a simple Object class like this. The `MyIsolatedKoinContext` class is holding our Koin instance:
First let's declare our isolated context holder, in order to store our isolated Koin instance in memory. This can be done with a simple Object class like this. The `MyIsolatedKoinContext` class is holding our Koin instance:

```kotlin
object MyIsolatedKoinContext {
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/koin-compose/multiplatform.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fun App() {

### Compose Preview with Koin

The `KoinApplication` function is also interesting to start dedicated context for preview. This can be also used to helo with Compose preview:
The `KoinApplication` function is also interesting to start dedicated context for preview. This can be also used to help with Compose preview:

```kotlin
@Composable
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/koin-core/extension-manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
title: Extension Manager
---

Here is a brief description of `KoinExtension` manager, deidcated to add new features inside Koin framework.
Here is a brief description of `KoinExtension` manager, dedicated to add new features inside Koin framework.

## Defining an extension

A Koin extension consist in having a class inhereting from `KoinExtension` interface:
A Koin extension consist in having a class inheriting from `KoinExtension` interface:

```kotlin
interface KoinExtension {
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/koin-core/injection-parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ val myModule = module {

## Resolving injected parameters in order

Instead of using `get()` to resovle a parameter, if you have several parameters of the same type you can use the index as follow `get(index)` (also same as `[ ]` operator):
Instead of using `get()` to resolve a parameter, if you have several parameters of the same type you can use the index as follow `get(index)` (also same as `[ ]` operator):

```kotlin
class Presenter(val view : View)
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/koin-core/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ 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 eitehr separate each moduel 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 either separate each model in files. See https://github.com/InsertKoinIO/koin/issues/1341 workaround
:::

## Lazy modules & background modules loading with Kotlin coroutines [Experimental]
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/koin-mp/kmp.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,4 @@ struct ContentView: View {

### New Native Memory Management

Activate experiemental with root [gradle.properties](http://gradle.properties) properties:
Activate experimental with root [gradle.properties](http://gradle.properties) properties:
4 changes: 2 additions & 2 deletions docs/reference/koin-test/checkmodules.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ class NiaAppModuleCheck {
Launch the JUnit test and you're done! ✅


As you may see, we use the extraTypesparameter to list types used in the Koin configuration but not declared directly. This is the case for SavedStateHandle and WorkerParameters types, that are used as injected parameters. The Context is declared by androidContext() function at start.
As you may see, we use the extra Types parameter to list types used in the Koin configuration but not declared directly. This is the case for SavedStateHandle and WorkerParameters types, that are used as injected parameters. The Context is declared by androidContext() function at start.


The verify() API is ultra light to run and doesn't require any kind of mock/stubb to run on your configuration.
The verify() API is ultra light to run and doesn't require any kind of mock/stub to run on your configuration.


### Koin Dynamic Check - CheckModules()
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ title: Koin Developer Hub
* [Opening Koin 1.0.0 Beta](https://medium.com/koin-developers/opening-the-koin-1-0-0-beta-version-99cb8be1c308)
* [On the road to Koin 1.0](https://medium.com/koin-developers/on-the-road-to-koin-1-0-0-a624af55d07)
* [Koin 0.9.2 — Maintenance fixes, new branding, roadmap for 1.0.0 & some other nice announces](https://medium.com/koin-developers/koin-0-9-2-maintenance-fixes-new-branding-roadmap-for-1-0-0-some-other-nice-announces-94f14648e4ad)
* [Koin 0.9.1 - Bug fixes & Improvments](https://medium.com/koin-developers/koin-0-9-1-bug-fixes-improvements-bug-fixes-d257cd2766fa)
* [Koin 0.9.1 - Bug fixes & Improvements](https://medium.com/koin-developers/koin-0-9-1-bug-fixes-improvements-bug-fixes-d257cd2766fa)
* [Koin 0.9.0 - Getting close to stable](https://medium.com/koin-developers/koin-0-9-0-getting-close-to-stable-release-74df9bb9e181)
* [Unlock your Android ViewModel power with Koin](https://medium.com/@giuliani.arnaud/unlock-your-android-viewmodel-power-with-koin-23eda8f493be)
* [koin 0.8.2 Improvements bugfixes and crash fix](https://medium.com/koin-developers/koin-0-8-2-improvements-bugfixes-and-crash-fix-6b6809fc1dd2)
Expand Down
75 changes: 47 additions & 28 deletions docs/setup/koin.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
title: Koin
---

All you need to setup Koin in your project
All you need to setup Koin in your project

## Current Versions

You can find all Koin packages on [maven central](https://search.maven.org/search?q=io.insert-koin).

Here are the current available versions:
Here are the currently available versions:

| Project | Version |
|----------|:-------------:|
Expand All @@ -30,20 +30,42 @@ Here are the current available versions:

### Kotlin

Add `koin-core` dependency to your application:
Starting from 3.5.0 you can use BOM-version to manage all Koin library versions. When using the BOM in your app, you don't need to add any version to the Koin library dependencies themselves. When you update the BOM version, all the libraries that you're using are automatically updated to their new versions.

```groovy
Add `koin-bom` BOM and `koin-core` dependency to your application:
```kotlin
implementation(platform("io.insert-koin:koin-bom:$koin_version"))
implementation("io.insert-koin:koin-core")
```
If you are using version catalogs:
```toml
[versions]
koin-bom = "x.x.x"
...

[libraries]
koin-bom = { module = "io.insert-koin:koin-bom", version.ref = "di-koin" }
koin-core = { module = "io.insert-koin:koin-core" }
...
```
```kotlin
dependencies {
implementation(libs.koin.bom)
implementation(libs.koin.core)
}
```

Or use an old way of specifying the exact dependency version for Koin:
```kotlin
dependencies {
compile "io.insert-koin:koin-core:$koin_version"
implementation("io.insert-koin:koin-core:$koin_version")
}
```

You are now ready to start Koin:
You are now ready to start Koin:

```kotlin
fun main() {

startKoin {
modules(...)
}
Expand All @@ -55,11 +77,11 @@ If you need testing capacity:
```groovy
dependencies {
// Koin Test features
testImplementation "io.insert-koin:koin-test:$koin_version"
testImplementation("io.insert-koin:koin-test:$koin_version")
// Koin for JUnit 4
testImplementation "io.insert-koin:koin-test-junit4:$koin_version"
testImplementation("io.insert-koin:koin-test-junit4:$koin_version")
// Koin for JUnit 5
testImplementation "io.insert-koin:koin-test-junit5:$koin_version"
testImplementation("io.insert-koin:koin-test-junit5:$koin_version")
}
```

Expand All @@ -73,19 +95,18 @@ Add `koin-android` dependency to your Android application:

```groovy
dependencies {
implementation "io.insert-koin:koin-android:$koin_android_version"
implementation("io.insert-koin:koin-android:$koin_android_version")
}
```

You are now ready to start Koin in your `Application` class:
You are now ready to start Koin in your `Application` class:

```kotlin
class MainApplication : Application(){
class MainApplication : Application() {
override fun onCreate() {
super.onCreate()

startKoin{
startKoin {
modules(appModule)
}
}
Expand All @@ -97,11 +118,11 @@ If you need extra features, add the following needed package:
```groovy
dependencies {
// Java Compatibility
implementation "io.insert-koin:koin-android-compat:$koin_android_version"
implementation("io.insert-koin:koin-android-compat:$koin_android_version")
// Jetpack WorkManager
implementation "io.insert-koin:koin-androidx-workmanager:$koin_android_version"
implementation("io.insert-koin:koin-androidx-workmanager:$koin_android_version")
// Navigation Graph
implementation "io.insert-koin:koin-androidx-navigation:$koin_android_version"
implementation("io.insert-koin:koin-androidx-navigation:$koin_android_version")
}
```

Expand All @@ -113,19 +134,18 @@ From now you can continue on Koin Tutorials to learn about using Koin: [Android

```groovy
dependencies {
implementation "io.insert-koin:koin-androidx-compose:$koin_android_compose_version"
implementation("io.insert-koin:koin-androidx-compose:$koin_android_compose_version")
}
```

You are now ready to start Koin in your `Application` class:
You are now ready to start Koin in your `Application` class:

```kotlin
class MainApplication : Application(){
class MainApplication : Application() {
override fun onCreate() {
super.onCreate()

startKoin{
startKoin {
modules(appModule)
}
}
Expand All @@ -143,8 +163,7 @@ Add `koin-core` dependency to your multiplatform application, for shared Kotlin

```groovy
dependencies {
compile "io.insert-koin:koin-core:$koin_version"
implementation("io.insert-koin:koin-core:$koin_version")
}
```

Expand All @@ -159,9 +178,9 @@ Add `koin-ktor` dependency to your Ktor application:
```groovy
dependencies {
// Koin for Ktor
implementation "io.insert-koin:koin-ktor:$koin_ktor"
implementation("io.insert-koin:koin-ktor:$koin_ktor")
// SLF4J Logger
implementation "io.insert-koin:koin-logger-slf4j:$koin_ktor"
implementation("io.insert-koin:koin-logger-slf4j:$koin_ktor")
}
```

Expand Down
15 changes: 7 additions & 8 deletions docs/setup/why.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
title: Why koin?
title: Why Koin?
---

Koin provides a easy and efficient way to incorporate dependency injection into any Kotlin application(Multiplatform, Android, backend ...)

The goals of Koin are:
- Simplify your Dependency Injection infrastructure with smart API
- Kotlin DSL easy to read, easy to use, to let you write any kind of application
- Provides different kind of integration from Android ecoysystem, to more backend needs like Ktor
- Provides different kind of integration from Android ecosystem, to more backend needs like Ktor
- Allow to be used with annotations

## Making your Kotlin development easy and productive
Expand All @@ -17,16 +17,16 @@ Koin is a smart Kotlin dependency injection library to keep you focused on your
```kotlin

class MyRepository()
class MyPresenterr(val repository : MyRepository)
class MyPresenter(val repository : MyRepository)

// just declare it
val myModule = module {
singleOf(::MyPresenterr)
singleOf(::MyPresenter)
singleOf(::MyRepository)
}
```

Koin gives you simple tools and API to let you build, assemble Kotlin related technologies into your application and let you scale your business with easyness.
Koin gives you simple tools and API to let you build, assemble Kotlin related technologies into your application and let you scale your business with easiness.

```kotlin
fun main() {
Expand All @@ -48,14 +48,13 @@ class MyApplication : Application() {
super.onCreate()

startKoin {

modules(myModule)
}
}
}
```

Koin provides easy and powerfull API to retrieve your dependencies anywhere in Android components, with just using by inject() or by viewModel()
Koin provides easy and powerful API to retrieve your dependencies anywhere in Android components, with just using by inject() or by viewModel()

```kotlin
class MyActivity : Application() {
Expand All @@ -69,7 +68,7 @@ class MyActivity : Application() {

Sharing code between mobile platforms is one of the major Kotlin Multiplatform use cases. With Kotlin Multiplatform Mobile, you can build cross-platform mobile applications and share common code between Android and iOS.

Koin provides multiplatform dependency injection and help build your components accross your native mobile applications, and web/backend applications.
Koin provides multiplatform dependency injection and help build your components across your native mobile applications, and web/backend applications.

## Performances and Productivity

Expand Down

0 comments on commit a9da4c6

Please sign in to comment.