{"id":18823592,"url":"https://github.com/05nelsonm/component-coroutines","last_synced_at":"2026-03-03T04:08:49.445Z","repository":{"id":39410195,"uuid":"421809162","full_name":"05nelsonm/component-coroutines","owner":"05nelsonm","description":"A wedge for retrieving coroutine Dispatchers to make testing and working in Kotlin Multiplatform common code easier","archived":false,"fork":false,"pushed_at":"2023-01-09T11:50:14.000Z","size":130,"stargazers_count":2,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-27T15:22:24.179Z","etag":null,"topics":["android","android-lib","android-libraries","android-library","android-libs","kotlin","kotlin-coroutines","kotlin-multiplatform","kotlin-multiplatform-library","kotlin-multiplatform-mobile"],"latest_commit_sha":null,"homepage":"https://kotlin-components.matthewnelson.io","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/05nelsonm.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-27T12:28:47.000Z","updated_at":"2023-06-03T19:48:29.000Z","dependencies_parsed_at":"2023-02-08T10:31:13.040Z","dependency_job_id":null,"html_url":"https://github.com/05nelsonm/component-coroutines","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/05nelsonm%2Fcomponent-coroutines","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/05nelsonm%2Fcomponent-coroutines/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/05nelsonm%2Fcomponent-coroutines/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/05nelsonm%2Fcomponent-coroutines/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/05nelsonm","download_url":"https://codeload.github.com/05nelsonm/component-coroutines/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248805807,"owners_count":21164391,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","android-lib","android-libraries","android-library","android-libs","kotlin","kotlin-coroutines","kotlin-multiplatform","kotlin-multiplatform-library","kotlin-multiplatform-mobile"],"created_at":"2024-11-08T00:54:06.563Z","updated_at":"2026-03-03T04:08:44.427Z","avatar_url":"https://github.com/05nelsonm.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# component-coroutines\n[![badge-license]][url-license]\n[![badge-latest-release]][url-latest-release]\n\n[![badge-kotlin]][url-kotlin]\n[![badge-coroutines]][url-coroutines]\n\n![badge-platform-android]\n![badge-platform-jvm]\n![badge-platform-js]\n![badge-platform-js-node]\n![badge-platform-linux]\n![badge-platform-macos]\n![badge-platform-ios]\n![badge-platform-tvos]\n![badge-platform-watchos]\n![badge-platform-windows]\n![badge-support-apple-silicon]\n![badge-support-js-ir]\n\nReferencing Coroutine `Dispatchers` within a class makes testing difficult which is why passing the `CoroutineDispatcher` via \nconstructor arguments is a wise decision. `component-coroutines`' `CoroutineDispatchers` interface serves as a wedge that points to \nwhatever dispatcher you set it up with.\n\nA full list of `kotlin-components` projects can be found [HERE](https://kotlin-components.matthewnelson.io)\n\n### Get Started\n\n\u003c!-- TAG_VERSION --\u003e\n\n```kotlin\n// build.gradle.kts\n\ndependencies {\n    implementation(\"io.matthewnelson.kotlin-components:coroutines:1.1.5\")\n}\n```\n\n\u003c!-- TAG_VERSION --\u003e\n\n```groovy\n// build.gradle\n\ndependencies {\n    implementation \"io.matthewnelson.kotlin-components:coroutines:1.1.5\"\n}\n```\n\n### Kotlin Version Compatibility\n\n**Note:** as of `1.1.0`, the experimental memory model for KotlinNative is enabled.\n\n\u003c!-- TAG_VERSION --\u003e\n\n| coroutines | kotlin | kotlinx-coroutines |\n|:----------:|:------:|:------------------:|\n|   1.1.5    | 1.8.0  |       1.6.4        |\n|   1.1.4    | 1.7.20 |       1.6.4        |\n|   1.1.3    | 1.6.21 |       1.6.3        |\n|   1.1.2    | 1.6.21 |       1.6.1        |\n|   1.1.1    | 1.6.21 |       1.6.1        |\n|   1.1.0    | 1.6.10 |       1.6.0        |\n|   1.0.0    | 1.5.31 |       1.5.2        |\n\n### `CoroutineDispatchers` Example (Using Android ViewModel + Hilt)\n```kotlin\n@Module\n@InstallIn(SingletonComponent::class)\nobject AppModule {\n    \n    @Provides\n    @Singleton\n    fun provideCoroutineDispatchers(): CoroutineDispatchers =\n        object : CoroutineDispatchers {\n            override val default: CoroutineDispatcher\n                get() = Dispatchers.Default\n            override val io: CoroutineDispatcher\n                get() = Dispatchers.IO\n            override val main: CoroutineDispatcher\n                get() = Dispatchers.Main\n            override val mainImmediate: CoroutineDispatcher\n                get() = Dispatchers.Main.immediate\n            override val unconfined: CoroutineDispatcher\n                get() = Dispatchers.Unconfined\n        }\n\n}\n\n@HiltViewModel\nclass MyViewModel @Inject constructor(\n    dispatchers: CoroutineDispatchers\n): ViewModel(), CoroutineDispatchers by dispatchers {\n\n    init {\n        viewModelScope.launch(io) {\n            // do work\n        }\n    }\n\n}\n```\n\n### Git\n\nThis project utilizes git submodules. You will need to initialize them when\ncloning the repository via:\n\n```bash\n$ git clone --recursive https://github.com/05nelsonm/component-coroutines.git\n```\n\nIf you've already cloned the repository, run:\n```bash\n$ git checkout master\n$ git pull\n$ git submodule update --init\n```\n\nIn order to keep submodules updated when pulling the latest code, run:\n```bash\n$ git pull --recurse-submodules\n```\n\n\u003c!-- TAG_VERSION --\u003e\n[badge-latest-release]: https://img.shields.io/badge/latest--release-1.1.5-blue.svg?style=flat\n[badge-license]: https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat\n\n\u003c!-- TAG_DEPENDENCIES --\u003e\n[badge-kotlin]: https://img.shields.io/badge/kotlin-1.8.0-blue.svg?logo=kotlin\n[badge-coroutines]: https://img.shields.io/badge/coroutines-1.6.4-blue.svg?logo=kotlin\n\n\u003c!-- TAG_PLATFORMS --\u003e\n[badge-platform-android]: http://img.shields.io/badge/-android-6EDB8D.svg?style=flat\n[badge-platform-jvm]: http://img.shields.io/badge/-jvm-DB413D.svg?style=flat\n[badge-platform-js]: http://img.shields.io/badge/-js-F8DB5D.svg?style=flat\n[badge-platform-js-node]: https://img.shields.io/badge/-nodejs-68a063.svg?style=flat\n[badge-platform-linux]: http://img.shields.io/badge/-linux-2D3F6C.svg?style=flat\n[badge-platform-macos]: http://img.shields.io/badge/-macos-111111.svg?style=flat\n[badge-platform-ios]: http://img.shields.io/badge/-ios-CDCDCD.svg?style=flat\n[badge-platform-tvos]: http://img.shields.io/badge/-tvos-808080.svg?style=flat\n[badge-platform-watchos]: http://img.shields.io/badge/-watchos-C0C0C0.svg?style=flat\n[badge-platform-wasm]: https://img.shields.io/badge/-wasm-624FE8.svg?style=flat\n[badge-platform-windows]: http://img.shields.io/badge/-windows-4D76CD.svg?style=flat\n[badge-support-android-native]: http://img.shields.io/badge/support-[AndroidNative]-6EDB8D.svg?style=flat\n[badge-support-apple-silicon]: http://img.shields.io/badge/support-[AppleSilicon]-43BBFF.svg?style=flat\n[badge-support-js-ir]: https://img.shields.io/badge/support-[js--IR]-AAC4E0.svg?style=flat\n\n[url-latest-release]: https://github.com/05nelsonm/component-coroutines/releases/latest\n[url-license]: https://www.apache.org/licenses/LICENSE-2.0.txt\n[url-kotlin]: https://kotlinlang.org\n[url-coroutines]: https://github.com/Kotlin/kotlinx.coroutines\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F05nelsonm%2Fcomponent-coroutines","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F05nelsonm%2Fcomponent-coroutines","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F05nelsonm%2Fcomponent-coroutines/lists"}