{"id":101692,"date":"2025-03-15T22:12:41","date_gmt":"2025-03-15T18:42:41","guid":{"rendered":"https:\/\/nabfollower.com\/blog\/koin-on-modularization-%da%86%da%af%d9%88%d9%86%d9%87-%d8%a7%d8%b2-%d8%a2%d9%86-%d8%a7%d8%b3%d8%aa%d9%81%d8%a7%d8%af%d9%87-%da%a9%d9%86%db%8c%d9%85%d8%9f\/"},"modified":"2025-03-15T22:12:41","modified_gmt":"2025-03-15T18:42:41","slug":"koin-on-modularization-%da%86%da%af%d9%88%d9%86%d9%87-%d8%a7%d8%b2-%d8%a2%d9%86-%d8%a7%d8%b3%d8%aa%d9%81%d8%a7%d8%af%d9%87-%da%a9%d9%86%db%8c%d9%85%d8%9f","status":"publish","type":"post","link":"https:\/\/nabfollower.com\/blog\/koin-on-modularization-%da%86%da%af%d9%88%d9%86%d9%87-%d8%a7%d8%b2-%d8%a2%d9%86-%d8%a7%d8%b3%d8%aa%d9%81%d8%a7%d8%af%d9%87-%da%a9%d9%86%db%8c%d9%85%d8%9f\/","title":{"rendered":"koin on modularization: \u0686\u06af\u0648\u0646\u0647 \u0627\u0632 \u0622\u0646 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u06a9\u0646\u06cc\u0645\u061f"},"content":{"rendered":"<div data-article-id=\"2335148\" id=\"article-body\">\n<p><strong>\u0645\u062f\u0648\u0644\u0627\u0631 \u0633\u0627\u0632\u06cc \u062f\u0631 \u0627\u0646\u062f\u0631\u0648\u06cc\u062f \u0686\u06cc\u0633\u062a\u061f<\/strong><\/p>\n<p>\u0645\u062f\u0648\u0644\u0627\u0631 \u0633\u0627\u0632\u06cc \u062f\u0631 \u0627\u0646\u062f\u0631\u0648\u06cc\u062f \u0628\u0647 \u0645\u0639\u0646\u0627\u06cc \u0634\u06a9\u0633\u062a\u0646 \u06cc\u06a9 \u0628\u0631\u0646\u0627\u0645\u0647 \u062f\u0631 \u0645\u0627\u0698\u0648\u0644 \u0647\u0627\u06cc \u06a9\u0648\u0686\u06a9\u062a\u0631 \u0648 \u0645\u0633\u062a\u0642\u0644 \u0628\u0647 \u062c\u0627\u06cc \u0646\u06af\u0647 \u062f\u0627\u0634\u062a\u0646 \u062a\u0645\u0627\u0645 \u06a9\u062f \u062f\u0631 \u06cc\u06a9 \u067e\u0631\u0648\u0698\u0647 \u0648\u0627\u062d\u062f \u0627\u0633\u062a. \u0647\u0631 \u0645\u0627\u0698\u0648\u0644 \u0645\u0633\u0626\u0648\u0644\u06cc\u062a \u062e\u0627\u0635 \u062e\u0648\u062f \u0631\u0627 \u062f\u0627\u0631\u062f \u0648 \u0645\u06cc \u062a\u0648\u0627\u0646\u062f \u0628\u0647 \u0637\u0648\u0631 \u062c\u062f\u0627\u06af\u0627\u0646\u0647 \u062a\u0648\u0633\u0639\u0647 \u060c \u0622\u0632\u0645\u0627\u06cc\u0634 \u0648 \u0646\u06af\u0647\u062f\u0627\u0631\u06cc \u0634\u0648\u062f.<\/p>\n<p><strong>\u067e\u06cc\u0634 \u0646\u06cc\u0627\u0632\u0647\u0627\u06cc \u0627\u0633\u0627\u0633\u06cc \u0628\u0631\u0627\u06cc \u062f\u0631\u06a9 \u0645\u062f\u0648\u0644\u0627\u0631 \u0633\u0627\u0632\u06cc<\/strong><\/p>\n<p>\u0642\u0628\u0644 \u0627\u0632 \u06cc\u0627\u062f\u06af\u06cc\u0631\u06cc \u0645\u062f\u0648\u0644\u0627\u0631 \u0633\u0627\u0632\u06cc \u060c \u0634\u0645\u0627 \u0628\u0627\u06cc\u062f \u0628\u0627 \u0622\u0646 \u0622\u0634\u0646\u0627 \u0628\u0627\u0634\u06cc\u062f:<\/p>\n<ul>\n<li>\u0633\u0627\u062e\u062a\u0627\u0631 \u067e\u0631\u0648\u0698\u0647 Android &#8211; \u062f\u0631\u06a9 \u0646\u062d\u0648\u0647 \u0633\u0627\u062e\u062a \u06cc\u06a9 \u0628\u0631\u0646\u0627\u0645\u0647 \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 APP\/SRC\/Main.<\/li>\n<li>Gradle \u0648 \u0648\u0627\u0628\u0633\u062a\u06af\u06cc \u0647\u0627 &#8211; \u062f\u0627\u0646\u0633\u062a\u0646 \u0686\u06af\u0648\u0646\u06af\u06cc \u0648\u0627\u0628\u0633\u062a\u06af\u06cc \u0647\u0627 \u062f\u0631 Build.Gradle.kts \u0645\u062f\u06cc\u0631\u06cc\u062a \u0645\u06cc \u0634\u0648\u0646\u062f.<\/li>\n<li>\u0628\u0633\u062a\u0647 \u0647\u0627 \u0648 \u0633\u0627\u0632\u0645\u0627\u0646 \u06a9\u062f &#8211; \u0627\u0635\u0648\u0644 \u0633\u0627\u0632\u0645\u0627\u0646\u062f\u0647\u06cc \u067e\u0631\u0648\u0646\u062f\u0647 \u0647\u0627 \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u0628\u0633\u062a\u0647 \u0647\u0627.<\/li>\n<li>\u0627\u0646\u0648\u0627\u0639 \u0645\u0627\u0698\u0648\u0644 \u0647\u0627\u06cc \u0627\u0646\u062f\u0631\u0648\u06cc\u062f\u06cc &#8211;<\/li>\n<li>\u0645\u0627\u0698\u0648\u0644 \u0628\u0631\u0646\u0627\u0645\u0647 (\u0628\u0631\u0646\u0627\u0645\u0647 \u0627\u0635\u0644\u06cc)<\/li>\n<li>\u0645\u0627\u0698\u0648\u0644 \u06a9\u062a\u0627\u0628\u062e\u0627\u0646\u0647 (\u0642\u0627\u0628\u0644\u06cc\u062a \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0645\u062c\u062f\u062f \u062f\u0631 \u0628\u06cc\u0646 \u067e\u0631\u0648\u0698\u0647 \u0647\u0627)<\/li>\n<li>\u0645\u0627\u0698\u0648\u0644 \u0648\u06cc\u0698\u06af\u06cc (\u0628\u0631\u0627\u06cc \u062a\u062d\u0648\u06cc\u0644 \u067e\u0648\u06cc\u0627 \u062f\u0631 \u0628\u0631\u0646\u0627\u0645\u0647 \u0647\u0627\u06cc \u0628\u0632\u0631\u06af)<\/li>\n<\/ul>\n<p>\u0686\u0631\u0627 \u0645\u062f\u0648\u0644\u0627\u0631 \u0633\u0627\u0632\u06cc\u061f<br \/>times \u0632\u0645\u0627\u0646 \u0633\u0627\u062e\u062a \u0633\u0631\u06cc\u0639\u062a\u0631 &#8211; \u0641\u0642\u0637 \u0645\u0627\u0698\u0648\u0644 \u0647\u0627\u06cc \u0627\u0635\u0644\u0627\u062d \u0634\u062f\u0647 \u06af\u0631\u062f\u0622\u0648\u0631\u06cc \u0645\u06cc \u0634\u0648\u0646\u062f.<br \/>\u2705 \u062d\u0641\u0638 \u06a9\u062f \u0628\u0647\u062a\u0631 &#8211; \u0645\u062f\u06cc\u0631\u06cc\u062a \u0648 \u0645\u0642\u06cc\u0627\u0633 \u0622\u0633\u0627\u0646\u062a\u0631.<br \/>\u2705 \u0642\u0627\u0628\u0644\u06cc\u062a \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0645\u062c\u062f\u062f &#8211; \u0648\u06cc\u0698\u06af\u06cc \u0647\u0627\u06cc \u0645\u0634\u062a\u0631\u06a9 \u0645\u0627\u0646\u0646\u062f \u0634\u0628\u06a9\u0647 \u06cc\u0627 \u062a\u0623\u06cc\u06cc\u062f \u0627\u0639\u062a\u0628\u0627\u0631 \u0631\u0627 \u0645\u06cc \u062a\u0648\u0627\u0646 \u062f\u0631 \u067e\u0631\u0648\u0698\u0647 \u0647\u0627 \u0628\u0647 \u0627\u0634\u062a\u0631\u0627\u06a9 \u06af\u0630\u0627\u0634\u062a.<br \/>\u2705 \u062a\u0648\u0633\u0639\u0647 \u0645\u0648\u0627\u0632\u06cc &#8211; \u062a\u06cc\u0645 \u0647\u0627 \u0645\u06cc \u062a\u0648\u0627\u0646\u0646\u062f \u0628\u0647 \u0637\u0648\u0631 \u0645\u0633\u062a\u0642\u0644 \u0631\u0648\u06cc \u0645\u0627\u0698\u0648\u0644 \u0647\u0627\u06cc \u0645\u062e\u062a\u0644\u0641 \u06a9\u0627\u0631 \u06a9\u0646\u0646\u062f.<\/p>\n<p>\u0627\u0645\u0631\u0648\u0632 \u0645\u0627 \u0642\u0635\u062f \u062f\u0627\u0631\u06cc\u0645 \u0645\u0631\u062d\u0644\u0647 \u0628\u0647 \u0645\u0631\u062d\u0644\u0647 \u0646\u062d\u0648\u0647 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0631\u0627 \u062a\u0646\u0638\u06cc\u0645 \u06a9\u0646\u06cc\u0645 <strong><em>\u0633\u06a9\u0647<\/em><\/strong>  \u062f\u0631 \u0645\u062f\u0648\u0644\u0627\u0631 \u0633\u0627\u0632\u06cc \u0628\u0627 \u0627\u062a\u0627\u0642 \u060c \u0645\u0642\u0627\u0648\u0645 \u0633\u0627\u0632\u06cc \u0648 ViewModel (\u0647\u0645\u0631\u0627\u0647 \u0628\u0627 USECase \u0648 \u0645\u062e\u0632\u0646).<\/p>\n<p>\u0642\u0628\u0644 \u0627\u0632 \u0634\u0631\u0648\u0639 \u06a9\u0627\u0631 \u0686\u0646\u062f \u0645\u0627\u0698\u0648\u0644 \u062c\u062f\u06cc\u062f \u0627\u06cc\u062c\u0627\u062f \u06a9\u0646\u06cc\u062f \u0648 \u0622\u0646\u0647\u0627 \u0631\u0627 \u0645\u0627\u0646\u0646\u062f \u0627\u06cc\u0646 \u0633\u0627\u062e\u062a\u0627\u0631 \u062f\u0647\u06cc\u062f:<br \/><img decoding=\"async\" src=\"https:\/\/media2.dev.to\/dynamic\/image\/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto\/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdkkt0h9n3lnrtu5mw2zd.png\" alt=\"\u0628\u0633\u062a\u0647 \u0628\u0646\u062f\u06cc_\" loading=\"lazy\" width=\"614\" height=\"1166\" title=\"\"><\/p>\n<p><strong>\u0645\u0631\u062d\u0644\u0647 1<\/strong><br \/>\u0634\u0645\u0627 \u0628\u0627\u06cc\u062f \u062a\u0639\u06cc\u06cc\u0646 \u06a9\u0646\u06cc\u062f \u06a9\u0647 \u0646\u0633\u062e\u0647 Gradle Koin \u0645\u06cc \u062e\u0648\u0627\u0647\u06cc\u062f \u0627\u0632 \u0622\u0646 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u06a9\u0646\u06cc\u062f. \u0628\u0631\u0627\u06cc \u0627\u06cc\u0646 \u0622\u0645\u0648\u0632\u0634 \u060c \u0645\u0646 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0645\u06cc \u06a9\u0646\u0645 <code>2.2.2<\/code> \u0646\u0633\u062e\u0647 \u062f\u0631\u062c\u0647 \u0628\u0646\u062f\u06cc \u0631\u0627 \u062f\u0631 <code>di<\/code> \u0645\u0627\u0698\u0648\u0644<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>implementation \"io.insert-koin:koin-android:2.2.2\"\nimplementation \"io.insert-koin:koin-androidx-viewmodel:2.2.2\"\nimplementation \"io.insert-koin:koin-androidx-scope:2.2.2\"\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><strong>\u0645\u0631\u062d\u0644\u0647 2<\/strong><br \/>\u0628\u0639\u062f \u0627\u0632 \u0627\u06cc\u0646\u06a9\u0647 \u0646\u0633\u062e\u0647 Koin \u0631\u0627 \u06a9\u0647 \u0627\u0632 \u0622\u0646 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0645\u06cc \u06a9\u0646\u06cc\u062f \u062a\u0635\u0645\u06cc\u0645 \u06af\u0631\u0641\u062a\u06cc\u062f \u060c \u0648\u0627\u0628\u0633\u062a\u06af\u06cc \u062f\u06cc\u06af\u0631\u06cc \u0631\u0627 \u0627\u0636\u0627\u0641\u0647 \u06a9\u0646\u06cc\u062f \u06a9\u0647 \u067e\u0631\u0648\u0698\u0647 \u0634\u0645\u0627 \u0628\u0631\u0627\u06cc \u062a\u0632\u0631\u06cc\u0642 \u0628\u0647 Koin \u0646\u06cc\u0627\u0632 \u062f\u0627\u0631\u062f <code>di<\/code> \u0645\u0627\u0698\u0648\u0644 \u0646\u06cc\u0632 \u062f\u0631 \u0627\u06cc\u0646 \u0622\u0645\u0648\u0632\u0634 \u0645\u06cc \u062e\u0648\u0627\u0647\u0645 \u062a\u0632\u0631\u06cc\u0642 \u06a9\u0646\u0645 <code>Retrofit<\/code> \u0628\u0631\u0627\u06cc \u0634\u0628\u06a9\u0647 \u060c <code>AndroidX Room<\/code> \u0628\u0631\u0627\u06cc DB \u0645\u062d\u0644\u06cc \u060c <code>Shared Preferences<\/code>\u0628\u0627 <code>ViewModel<\/code> \u0628\u0631\u0627\u06cc \u0645\u062f\u06cc\u0631\u06cc\u062a \u062f\u0627\u062f\u0647 \u0647\u0627 \u060c \u0648 <code>Coroutine<\/code> \u0628\u0631\u0627\u06cc \u0646\u062e \u0632\u062f\u0646<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>implementation \"io.insert-koin:koin-android:2.2.2\"\nimplementation \"io.insert-koin:koin-androidx-viewmodel:2.2.2\"\nimplementation \"io.insert-koin:koin-androidx-scope:2.2.2\"\nimplementation \"javax.inject:javax.inject:1\"\n\nimplementation \"com.squareup.okhttp3:logging-interceptor:4.9.0\"\nimplementation \"com.squareup.retrofit2:retrofit:2.9.0\"\nimplementation \"com.squareup.retrofit2:converter-moshi:2.9.0\"\nimplementation \"com.squareup.retrofit2:converter-gson:2.9.0\"\n\nimplementation \"com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2\"\n\nimplementation \"androidx.room:room-runtime:2.4.2\"\nkapt \"androidx.room:room-compiler:2.4.2\"\nimplementation \"androidx.room:room-ktx:2.4.2\"\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><strong>\u0645\u0631\u062d\u0644\u0647 3<\/strong><br \/>\u0645\u0627\u0698\u0648\u0644 \u0634\u0628\u06a9\u0647 \u060c \u0645\u0627\u0698\u0648\u0644 API \u060c \u0645\u0627\u0698\u0648\u0644 \u062a\u0646\u0638\u06cc\u0645\u0627\u062a \u0645\u0634\u062a\u0631\u06a9 \u060c \u0645\u0627\u0698\u0648\u0644 \u0627\u062a\u0627\u0642 \u0648 \u0645\u0627\u0698\u0648\u0644 ViewModel \u0631\u0627 \u062a\u0639\u0631\u06cc\u0641 \u06a9\u0646\u06cc\u062f (\u0645\u0627 \u0647\u0645\u0686\u0646\u06cc\u0646 \u0627\u0632 USECase \u0648 \u0645\u0627\u0698\u0648\u0644 \u0645\u062e\u0632\u0646 \u0628\u0631\u0627\u06cc \u0627\u0635\u0644 \u0645\u0639\u0645\u0627\u0631\u06cc \u062a\u0645\u06cc\u0632 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0645\u06cc \u06a9\u0646\u06cc\u0645)<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>class ApiModule {\n    companion object {\n        val apiModule = module(override = true) {\n            single { provideDisneyApi(get()) }\n        }\n\n        fun provideDisneyApi(retrofit: Retrofit): Api {\n            return retrofit.create(Api::class.java)\n        }\n    }\n}\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>class NetworkModule  {\n    companion object {\n        private fun httpInterceptor() = HttpLoggingInterceptor().apply {\n            return HttpLoggingInterceptor { _ -&gt;\n            }.apply {\n                level = HttpLoggingInterceptor.Level.BODY\n            }\n        }\n\n        fun provideNetworkHandler(context: Context) = NetworkHandler(context)\n\n        fun provideOkHttpClient() : OkHttpClient {\n            return Builder.initInterceptor(httpInterceptor())\n        }\n\n        fun provideRetrofitService(okHttpClient: OkHttpClient): Retrofit {\n            return Builder.initRetrofit(okHttpClient)\n        }\n    }\n}\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>class SharedPrefModule {\n    companion object {\n        fun providePreference(context: Context) : SharedPreferences {\n            return context.getSharedPreferences(\"SharedPreferenceName\", Context.MODE_PRIVATE)\n        }\n    }\n}\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>class RoomModule {\n    companion object {\n        fun provideRoom(context: Context) : DBConfig {\n            return Room.databaseBuilder(context, DBConfig::class.java, \"db_sample\")\n                .fallbackToDestructiveMigration()\n                .build()\n        }\n    }\n}\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>class RepositoryModule {\n    companion object {\n        val repositoryModule = module(override = true) {\n            single<characterrepository> { return@single CharacterRepositoryImpl(get(), get()) }\n        }\n    }\n}\n<\/characterrepository><\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>class UseCaseModule {\n    companion object {\n        val useCaseModule = module(override = true) {\n            single<characterusecase> { return@single CharacterUseCaseImpl(get()) }\n        }\n    }\n}\n<\/characterusecase><\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>class ViewModelModule {\n    companion object {\n        val viewModelModule = module(override = true) {\n            viewModel { GamesListVM(get(), get()) }\n            viewModel { GamesDetailVM(get(), get()) }\n            viewModel { GamesFavoriteVM(get(), get(), get()) }\n        }\n    }\n}\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u0628\u0639\u062f \u0627\u0632 \u0627\u06cc\u0646\u06a9\u0647 \u0647\u0645\u0647 \u0622\u0646\u0647\u0627 \u0631\u0627 \u0627\u0636\u0627\u0641\u0647 \u06a9\u0631\u062f\u06cc\u062f \u060c \u0645\u0627\u0698\u0648\u0644\u06cc \u0631\u0627 \u06a9\u0647 \u0628\u0647 \u0639\u0646\u0648\u0627\u0646 \u06cc\u06a9 \u0645\u0627\u0698\u0648\u0644 &#8220;\u0647\u0633\u062a\u0647&#8221; \u062f\u0631 \u0627\u0648\u0644\u0648\u06cc\u062a \u0642\u0631\u0627\u0631 \u062f\u0627\u062f\u0647 \u0648 \u0637\u0628\u0642\u0647 \u0628\u0646\u062f\u06cc \u06a9\u0646\u06cc\u062f <code>AppModule<\/code> \u06a9\u0644\u0627\u0633. \u062f\u0631 \u0627\u06cc\u0646 \u0622\u0645\u0648\u0632\u0634 \u0645\u06cc \u067e\u06cc\u0686\u0645 <code>retrofit<\/code>\u0628\u0627 <code>room<\/code>\u0648\u062a <code>shared preferences<\/code> \u0645\u0627\u0698\u0648\u0644 \u0645\u0627\u0646\u0646\u062f \u0627\u06cc\u0646:<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>val MainAppModule = module(override = true) {\n    single { NetworkModule.provideOkHttpClient() }\n    single { NetworkModule.provideRetrofitService(get()) }\n    single { NetworkModule.provideNetworkHandler(androidContext()) }\n    single { RoomModule.provideRoom(androidContext()) }\n    single { SharedPrefModule.providePreference(androidContext()) }\n}\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><strong>\u0645\u0631\u062d\u0644\u0647 4<\/strong><br \/>\u0628\u0627 \u0622\u0646\u0647\u0627 \u062a\u0645\u0627\u0633 \u0628\u06af\u06cc\u0631\u06cc\u062f <code>StartKoin<\/code> \u062f\u0631 <code>Application Class<\/code> \u062f\u0631 \u0645\u0627\u0698\u0648\u0644 \u0628\u0631\u0646\u0627\u0645\u0647 (\u0645\u0627\u0698\u0648\u0644 \u067e\u06cc\u0634 \u0641\u0631\u0636). \u0645\u0646 \u0645\u0627\u0698\u0648\u0644 ViewModel \u060c Repository \u060c USECase \u0648 API \u0631\u0627 \u0628\u0647 \u0639\u0646\u0648\u0627\u0646 \u0647\u0645\u0627\u0646 \u0633\u0637\u062d \u0628\u0627 \u0645\u0627\u0698\u0648\u0644 MainApp \u0645\u06cc \u0646\u0627\u0645\u0645<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>class DisneyApp : Application() {\n    override fun onCreate() {\n        super.onCreate()\n        startKoin {\n            androidLogger(Level.ERROR)\n            androidContext(this@DisneyApp)\n            modules(MainAppModule, ApiModule.apiModule, RepositoryModule.repositoryModule,\n                UseCaseModule.useCaseModule, ViewModelModule.viewModelModule\n            )\n        }\n    }\n\n}\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u0648 voila! \u062a\u0628\u0631\u06cc\u06a9 \u0645\u06cc \u06af\u0648\u06cc\u0645 \u0634\u0645\u0627 Koin \u0631\u0627 \u062f\u0631 \u0646\u0633\u062e\u0647 \u0645\u062f\u0648\u0644\u0627\u0631 \u0633\u0627\u062e\u062a\u0647 \u0627\u06cc\u062f. \u0622\u0633\u0627\u0646 \u0627\u0633\u062a \u0646\u0647\u061f<\/p>\n<p>\u0628\u0631\u0646\u0627\u0645\u0647 \u0646\u0648\u06cc\u0633\u06cc \u0645\u0628\u0627\u0631\u06a9 \ud83d\ude42<\/p>\n<p>\u0628\u0631\u0627\u06cc \u067e\u0631\u0648\u0698\u0647 \u0646\u0645\u0648\u0646\u0647 \u060c \u0645\u06cc \u062a\u0648\u0627\u0646\u06cc\u062f \u0628\u0647 \u0627\u06cc\u0646 GitHub \u0645\u0631\u0627\u062c\u0639\u0647 \u06a9\u0646\u06cc\u062f<\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u0645\u062f\u0648\u0644\u0627\u0631 \u0633\u0627\u0632\u06cc \u062f\u0631 \u0627\u0646\u062f\u0631\u0648\u06cc\u062f \u0686\u06cc\u0633\u062a\u061f \u0645\u062f\u0648\u0644\u0627\u0631 \u0633\u0627\u0632\u06cc \u062f\u0631 \u0627\u0646\u062f\u0631\u0648\u06cc\u062f \u0628\u0647 \u0645\u0639\u0646\u0627\u06cc \u0634\u06a9\u0633\u062a\u0646 \u06cc\u06a9 \u0628\u0631\u0646\u0627\u0645\u0647 \u062f\u0631 \u0645\u0627\u0698\u0648\u0644 \u0647\u0627\u06cc \u06a9\u0648\u0686\u06a9\u062a\u0631 \u0648 \u0645\u0633\u062a\u0642\u0644 \u0628\u0647 \u062c\u0627\u06cc \u0646\u06af\u0647 \u062f\u0627\u0634\u062a\u0646 \u062a\u0645\u0627\u0645 \u06a9\u062f \u062f\u0631 \u06cc\u06a9 \u067e\u0631\u0648\u0698\u0647 \u0648\u0627\u062d\u062f \u0627\u0633\u062a. \u0647\u0631 \u0645\u0627\u0698\u0648\u0644 \u0645\u0633\u0626\u0648\u0644\u06cc\u062a \u062e\u0627\u0635 \u062e\u0648\u062f \u0631\u0627 \u062f\u0627\u0631\u062f \u0648 \u0645\u06cc \u062a\u0648\u0627\u0646\u062f \u0628\u0647 \u0637\u0648\u0631 \u062c\u062f\u0627\u06af\u0627\u0646\u0647 \u062a\u0648\u0633\u0639\u0647 \u060c \u0622\u0632\u0645\u0627\u06cc\u0634 \u0648 \u0646\u06af\u0647\u062f\u0627\u0631\u06cc \u0634\u0648\u062f. \u067e\u06cc\u0634 \u0646\u06cc\u0627\u0632\u0647\u0627\u06cc \u0627\u0633\u0627\u0633\u06cc \u0628\u0631\u0627\u06cc \u062f\u0631\u06a9 &hellip;<\/p>\n","protected":false},"author":2,"featured_media":101693,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"https:\/\/media2.dev.to\/dynamic\/image\/width=1000,height=500,fit=cover,gravity=auto,format=auto\/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjjgyujrb5xawkyvu8k8i.png","fifu_image_alt":"","footnotes":""},"categories":[339],"tags":[],"class_list":["post-101692","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dev"],"_links":{"self":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/posts\/101692","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/comments?post=101692"}],"version-history":[{"count":0,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/posts\/101692\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/media\/101693"}],"wp:attachment":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/media?parent=101692"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/categories?post=101692"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/tags?post=101692"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}