{"id":375478,"date":"2024-05-21T06:25:32","date_gmt":"2024-05-21T06:25:32","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=375478"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=375478","title":{"rendered":"<span>Room \u0434\u043b\u044f Kotlin Multiplatform. \u041f\u0440\u043e\u0431\u0443\u0435\u043c \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/sx\/ju\/9_\/sxju9_erpayx03ib5v8ybxw-0pw.png\" width=\"720\" data-src=\"https:\/\/habrastorage.org\/webt\/sx\/ju\/9_\/sxju9_erpayx03ib5v8ybxw-0pw.png\"\/><br \/>  \u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442! \u041d\u0430 \u0441\u0432\u044f\u0437\u0438 \u0410\u043d\u043d\u0430 \u0416\u0430\u0440\u043a\u043e\u0432\u0430, \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u0433\u0440\u0443\u043f\u043f\u044b \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 Usetech. \u0412 \u043d\u0430\u0447\u0430\u043b\u0435 \u043c\u0430\u044f Google \u043d\u0430\u0441 \u043f\u043e\u0440\u0430\u0434\u043e\u0432\u0430\u043b\u0438 \u0440\u0435\u043b\u0438\u0437\u0430\u043c\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0434\u043b\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449. \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Kotlin Multiplatform \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/developer.android.com\/kotlin\/multiplatform\/room\">Room<\/a> (\u0432\u0435\u0440\u0441\u0438\u044f 2.7.0-alpha01 \u0438 \u0432\u044b\u0448\u0435). <br \/>  \u0418 \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0434\u0430\u043d\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 <a href=\"https:\/\/github.com\/anioutkazharkova\/room-kmp\">\u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Todo<\/a>, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u043d\u0430 KMP \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Compose Multiplatform.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/d3\/cw\/ri\/d3cwrigsmllrygurzuvgqjs0aoq.png\" width=\"540\" data-src=\"https:\/\/habrastorage.org\/webt\/d3\/cw\/ri\/d3cwrigsmllrygurzuvgqjs0aoq.png\"\/><\/p>\n<p>  \u041a\u0440\u043e\u043c\u0435 Room, \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 Lifecycle-viewmodel \u0434\u043b\u044f KMP. \u0418 Koin \u0434\u043b\u044f DI \u0438 \u0433\u0430\u0440\u043c\u043e\u043d\u0438\u0438.<\/p>\n<p>  <a name=\"habracut\"><\/a><br \/>  \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u041d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 Room \u0438 SQLite (\u0435\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c). \u041f\u0440\u043e\u043f\u0438\u0448\u0435\u043c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 lib.versions:  <\/p>\n<pre><code class=\"kotlin\">\/*lib.versions*\/ [versions] \\\\.. androidxRoom = \"2.7.0-alpha01\" sqlite = \"2.5.0-alpha01\"  [libraries] \\\\.. androidx-room-compiler = { group = \"androidx.room\", name = \"room-compiler\", version.ref = \"androidxRoom\" } androidx-room-runtime = { group = \"androidx.room\", name = \"room-runtime\", version.ref = \"androidxRoom\" } sqlite-bundled = { module = \"androidx.sqlite:sqlite-bundled\", version.ref = \"sqlite\" } sqlite = { module = \"androidx.sqlite:sqlite\", version.ref = \"sqlite\" } <\/code><\/pre>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043c\u044b \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0434\u043b\u044f Room \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0438 runtime. SQLite \u2014 \u044d\u0442\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c Room. <\/p>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043f\u043b\u0430\u0433\u0438\u043d \u0434\u043b\u044f Room:  <\/p>\n<pre><code class=\"kotlin\">\/*lib.versions*\/ [plugins] \\\\... room = { id = \"androidx.room\", version.ref = \"androidxRoom\" }  \/*build.gradle.kts app*\/ plugins { \\\\... alias(libs.plugins.room).apply(false) }  \/*build.gradle.kts shared*\/ plugins { \\\\... alias(libs.plugins.room) } <\/code><\/pre>\n<p>  \u041d\u0435 \u0437\u0430\u0431\u0443\u0434\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u0431\u043b\u043e\u043a \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0442\u0430\u0440\u0433\u0435\u0442\u0430 commonMain:  <\/p>\n<pre><code class=\"kotlin\">sourceSets {         commonMain.dependencies {             implementation(libs.androidx.room.runtime)             implementation(libs.sqlite.bundled)             implementation(libs.sqlite)         }     } <\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044e \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0443. \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 KSP. \u041e\u0434\u043d\u0438\u043c \u0438\u0437 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u044d\u0442\u0430\u043f\u043e\u0432 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 Room \u0431\u044b\u043b \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u0441 KAPT \u043d\u0430 KSP, \u0447\u0442\u043e \u0438 \u0441\u0434\u0435\u043b\u0430\u043b\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u043b\u0430\u0433\u0438\u043d KSP:  <\/p>\n<pre><code class=\"kotlin\">\/*lib.versions*\/ [versions] \\\\... ksp = \"1.9.23-1.0.19\" kotlin = \"1.9.23\"  \\\\...  [plugins] \\\\... ksp = { id = \"com.google.devtools.ksp\", version.ref = \"ksp\" } <\/code><\/pre>\n<p>  \u0423\u0447\u0442\u0438\u0442\u0435, \u0447\u0442\u043e <b>\u0432\u0435\u0440\u0441\u0438\u044f Kotlin \u0434\u043e\u043b\u0436\u043d\u0430 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0442\u044c \u0441 \u043c\u0430\u0436\u043e\u0440\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 KSP<\/b>. <\/p>\n<pre><code class=\"kotlin\">\/*build.gradle.kts app*\/ plugins {  \\\\... alias(libs.plugins.ksp) apply false }  \/*build.gradle.kts shared*\/ plugins { \\\\... id(\"com.google.devtools.ksp\") } <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u0441\u0430\u043c\u044b\u0439 \u043d\u0438\u0437 build.gradle.kts (shared) \u0431\u043b\u043e\u043a \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0438\u043d\u0433\u0430 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 Room \u0447\u0435\u0440\u0435\u0437 KSP:  <\/p>\n<pre><code class=\"kotlin\">dependencies {     add(\"kspAndroid\", libs.androidx.room.compiler)     add(\"kspIosSimulatorArm64\", libs.androidx.room.compiler)     add(\"kspIosX64\", libs.androidx.room.compiler)     add(\"kspIosArm64\", libs.androidx.room.compiler) } <\/code><\/pre>\n<p>  \u0412\u0430\u0436\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442: \u0434\u043b\u044f Kotlin 1.9.20 \u0432 gradle.properties \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c kotlin.native.disableCompilerDaemon = true.  <\/p>\n<pre><code class=\"kotlin\"># Disabled due to https:\/\/youtrack.jetbrains.com\/issue\/KT-65761 kotlin.native.disableCompilerDaemon = true <\/code><\/pre>\n<p>  \u0423\u043a\u0430\u0436\u0435\u043c \u0442\u0430\u043a\u0436\u0435 \u043f\u0443\u0442\u044c \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0441\u0445\u0435\u043c \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445:  <\/p>\n<pre><code class=\"kotlin\">room {     schemaDirectory(\"$projectDir\/schemas\") }<\/code><\/pre>\n<p>  \u0421\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u0443\u0435\u043c Gradle. <br \/>  \u0413\u043e\u0442\u043e\u0432\u043e, Room \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438. \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u043d\u0430\u0448\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435.<\/p>\n<p>  \u0422\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0438 \u0432 Android \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438, \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0448\u0430\u0433\u0438 (\u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043d\u044e\u0430\u043d\u0441\u0430\u043c\u0438):<br \/>  1. \u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c-\u0434\u0430\u043d\u043d\u044b\u0445 Entity \u0434\u043b\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445.<br \/>  2. \u0421\u043e\u0437\u0434\u0430\u0442\u044c Dao \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438\u0437 \u043d\u0430\u0448\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<br \/>  3. \u041d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435, \u043a\u0430\u043a \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a RoomDatabase.<br \/>  4. \u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u2014 \u0448\u0430\u0433 \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439, \u0431\u043e\u043b\u044c\u0448\u0435 \u0434\u043b\u044f \u0441\u043e\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0434\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043e\u0431\u044b\u0447\u043d\u044b\u0439 data class \u0441 \u043d\u0443\u0436\u043d\u044b\u043c\u0438 \u043d\u0430\u043c \u043f\u043e\u043b\u044f\u043c\u0438. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e @`Entity \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438\u0437 \u043c\u043e\u0434\u0435\u043b\u0438. \u0410\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f @`PrimaryKey \u043f\u043e\u043c\u0435\u0442\u0438\u0442 \u043f\u043e\u043b\u0435 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430:  <\/p>\n<pre><code class=\"kotlin\">@Entity data class TodoEntity(     @PrimaryKey(autoGenerate = true) val id: Long = 0,     val title: String,     val content: String     val date: String )<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441-Dao \u0441 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u0434\u043b\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 (Insert) \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 (Select):  <\/p>\n<pre><code class=\"kotlin\">@Dao interface TodoDao {     @Insert     suspend fun insert(item: TodoEntity)      @Query(\"SELECT count(*) FROM TodoEntity\")     suspend fun count(): Int      @Query(\"SELECT * FROM TodoEntity\")     fun getAllAsFlow(): Flow&lt;List&lt;TodoEntity>> } <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0441\u0430\u043c\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u043c\u0443 \u2014 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445. \u041a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e, \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441-\u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a RoomDatabase:  <\/p>\n<pre><code class=\"kotlin\">@Database(entities = [TodoEntity::class], version = 1) abstract class AppDatabase : RoomDatabase() {     abstract fun getDao(): TodoDao } <\/code><\/pre>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043a \u043d\u0435\u043c\u0443 \u0431\u0438\u043b\u0434\u0435\u0440 \u0441 \u0443\u0447\u0435\u0442\u043e\u043c expect\/actual:  <\/p>\n<pre><code class=\"kotlin\">\/\/Android fun getDatabaseBuilder(ctx: Context): RoomDatabase.Builder&lt;AppDatabase> {     val appContext = ctx.applicationContext     val dbFile = appContext.getDatabasePath(\"my_room.db\")     return Room.databaseBuilder&lt;AppDatabase>(         context = appContext,         name = dbFile.absolutePath     ) } .setDriver(BundledSQLiteDriver()) .setQueryCoroutineContext(Dispatchers.IO)  fun getDatabase(ctx: Context): AppDatabase {     return getDatabaseBuilder(ctx).build() }  \/\/iOS fun getDatabaseBuilder(): RoomDatabase.Builder&lt;AppDatabase> {     val dbFilePath = NSHomeDirectory() + \"\/my_room.db\"     return Room.databaseBuilder&lt;AppDatabase>(         name = dbFilePath,         factory =  { AppDatabase::class.instantiateImpl() }     ) .setDriver(BundledSQLiteDriver()) .setQueryCoroutineContext(Dispatchers.IO) }  fun getDatabase(): AppDatabase {     return getDatabaseBuilder().build() } <\/code><\/pre>\n<p>  \u0423 \u043d\u0430\u0448\u0438\u0445 \u0431\u0438\u043b\u0434\u0435\u0440\u043e\u0432 \u0440\u0430\u0437\u043d\u0430\u044f \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u043c\u0435\u0442\u0438\u0442\u044c \u0438\u0445 actual \u0438 \u0437\u0430\u0434\u0430\u0442\u044c \u043e\u0431\u0449\u0443\u044e \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0443 \u0441 expect \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Koin \u0434\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u0438 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c expect\/actual \u043c\u043e\u0434\u0443\u043b\u044c.  <\/p>\n<pre><code class=\"kotlin\">\/\/commonMain expect fun platformModule(): Module  \/\/androidMain actual fun platformModule() = module {     single&lt;AppDatabase> { getDatabase(get()) } }  \/\/iOSMain actual fun platformModule() = module {     single&lt;AppDatabase> { getDatabase() } } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0447\u0435\u043b\u043b\u0435\u043d\u0434\u0436: \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b Android \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f? \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432 commonMain \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c-\u0431\u043b\u043e\u043a\u043e\u043c:  <\/p>\n<pre><code class=\"kotlin\">fun initKoin(appDeclaration: KoinAppDeclaration = {}) =     startKoin {         appDeclaration()         modules(platformModule())     }<\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0444\u0430\u0431\u0440\u0438\u043a\u0443-\u0441\u0438\u043d\u0433\u043b\u0442\u043e\u043d \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a di:  <\/p>\n<pre><code class=\"kotlin\">object Koin {    var di: KoinApplication? = null     fun setupKoin(appDeclaration: KoinAppDeclaration = {}) {        if (di == null) {            di = initKoin(appDeclaration)        }    } }<\/code><\/pre>\n<p>  Koin.setupKoin() \u043c\u044b \u0432\u044b\u0437\u043e\u0432\u0435\u043c \u0438\u0437 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0445 Android \u0438 iOS \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439:<\/p>\n<pre><code class=\"kotlin\">Koin.setupKoin {     androidContext(applicationContext) } <\/code><\/pre>\n<p>  \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0438 \u0441 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u043c\u0438 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438. \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044e \u043b\u043e\u0433\u0438\u043a\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435\u043c \u043a \u044d\u043a\u0440\u0430\u043d\u0430\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<br \/>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439. \u0433\u0434\u0435 \u0432\u044b\u0437\u043e\u0432\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u044b Dao:  <\/p>\n<pre><code class=\"kotlin\">class TaskRepository(         private val database: AppDatabase ) { private val dao: TodoDao by lazy {     database.getDao() }      suspend fun addTodo(todoEntity: TodoEntity) {         dao.insert(todoEntity)     }      suspend fun loadTodos(): Flow&lt;List&lt;TodoEntity>> {         return dao.getAllAsFlow()     } }<\/code><\/pre>\n<p>  \u0418 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043d\u0430\u0448\u0438 ViewModel \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u044b\u0437\u043e\u0432\u0430. \u0414\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0438:  <\/p>\n<pre><code class=\"kotlin\">class AddTodoViewModel(     private val taskRepository: TaskRepository ) : ViewModel() {      val titleText: MutableStateFlow&lt;String> = MutableStateFlow&lt;String>(\"\")     fun onConfirm() {         viewModelScope.launch {             taskRepository.addTodo(TodoEntity(title = titleText.value))         }     } } <\/code><\/pre>\n<p>  \u0418 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0432\u044b\u0437\u043e\u0432 \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438:  <\/p>\n<pre><code class=\"kotlin\"> class TodoViewModel(private val repository: TaskRepository) : ViewModel() {      val tasks: MutableSharedFlow&lt;List&lt;TodoEntity>> = MutableSharedFlow(1, onBufferOverflow = BufferOverflow.DROP_OLDEST)     fun loadData() {         viewModelScope.launch {             repository.loadTodos().collectLatest {                 tasks.tryEmit(it)             }         }     } }<\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0443:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ku\/gd\/zp\/kugdzpxohh7xy5xua2co4936n54.png\" width=\"360\" data-src=\"https:\/\/habrastorage.org\/webt\/ku\/gd\/zp\/kugdzpxohh7xy5xua2co4936n54.png\"\/><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/n2\/do\/kt\/n2doktkws2ilk_ojuuhqxodgkqu.png\" width=\"360\" data-src=\"https:\/\/habrastorage.org\/webt\/n2\/do\/kt\/n2doktkws2ilk_ojuuhqxodgkqu.png\"\/><\/p>\n<p>  \u041f\u0440\u043e\u0431\u0443\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043d\u0430 iOS. \u041e\u0431\u044a\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u0445\u0435\u043c\u044b \u0437\u0430\u043d\u044f\u043b\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0438\u043d\u0443\u0442.<br \/>  \u0422\u0430\u043a\u0436\u0435 \u0443 \u0432\u0430\u0441 \u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u043b\u0435\u0437\u0442\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 ksp. API \u0432\u0441\u0435-\u0442\u0430\u043a\u0438 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u0438 \u043d\u0435 \u0431\u0435\u0437 \u0431\u0430\u0433\u043e\u0432.<br \/>  \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u044c toolChain \u0438 \u0432\u0435\u0440\u0441\u0438\u044e Kotlin \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430:  <\/p>\n<pre><code class=\"kotlin\">kotlin {     jvmToolchain(17) } \/\/... compilerOptions {         languageVersion.set(KOTLIN_1_9)     } <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ku\/gd\/zp\/kugdzpxohh7xy5xua2co4936n54.png\" width=\"360\" data-src=\"https:\/\/habrastorage.org\/webt\/ku\/gd\/zp\/kugdzpxohh7xy5xua2co4936n54.png\"\/><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/gx\/rk\/ga\/gxrkgazg2pelwuausx_3v_cu4u0.png\" width=\"360\" data-src=\"https:\/\/habrastorage.org\/webt\/gx\/rk\/ga\/gxrkgazg2pelwuausx_3v_cu4u0.png\"\/><\/p>\n<p>  \u041d\u0430\u0448 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442:<br \/>  <a href=\"https:\/\/github.com\/anioutkazharkova\/room-kmp\">github.com\/anioutkazharkova\/room-kmp<\/a><\/p>\n<p>  \u0421 \u043a\u0430\u043a\u0438\u043c\u0438 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0430\u0441\u044c \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435:<br \/>   \u2014 \u043d\u0435\u0432\u0435\u0440\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f sqlite-bundle, \u0438\u0437-\u0437\u0430 \u0447\u0435\u0433\u043e \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0438\u043d\u0441\u0442\u0430\u043d\u0441 AppDatabase \u043d\u0430 iOS<br \/>   \u2014 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0438 sqlite, \u0447\u0442\u043e\u0431\u044b \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u043d\u0430 iOS \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e<br \/>   \u2014 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c toolchain \u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b Kotlin \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438<br \/>   \u2014 \u0432 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0435 Android Developer \u043d\u0435 \u0431\u044b\u043b\u0430 \u0443\u043a\u0430\u0437\u0430\u043d\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u0432 \u0431\u0438\u043b\u0434\u0435\u0440 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u0431\u0435\u0437 \u043d\u0435\u0433\u043e \u0443 \u043c\u0435\u043d\u044f \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e <br \/>   \u2014 \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u043f\u0440\u043e KSP, \u0431\u0435\u0437 \u043d\u0435\u0433\u043e Room \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<p>  <b>\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f Room KMP<\/b><br \/>  \u0415\u0441\u0442\u044c \u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u044f \u0432 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 Room \u0434\u043b\u044f Kotlin Multiplatform. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 \u043d\u0435-Android \u0442\u0430\u0440\u0433\u0435\u0442\u0430\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u043d\u044b\u0445 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0435\u0439 @`RawQuery, \u0432\u044b\u0437\u043e\u0432\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0443. \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u044d\u0442\u043e\u0439 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 Room.<\/p>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 Android: <br \/>  1 API \u043a\u043e\u043b\u043b\u0431\u044d\u043a\u0430:  <\/p>\n<ul>\n<li>RoomDatabase.Builder.setQueryCallback, <\/li>\n<li>RoomDatabase.QueryCallback<\/li>\n<\/ul>\n<p>  2 \u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u0442\u0430\u0439\u043c-\u0430\u0443\u0442\u0443:  <\/p>\n<ul>\n<li> RoomDatabase.Builder.setAutoCloseTimeout<\/li>\n<\/ul>\n<p>  3 \u041c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u044b \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430:   <\/p>\n<ul>\n<li>RoomDatabase.Builder.enableMultiInstanceInvalidation<\/li>\n<\/ul>\n<p>  4 \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0430\u0441\u0441\u0435\u0442\u043e\u0432, \u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u0442.\u043f:  <\/p>\n<ul>\n<li>RoomDatabase.Builder.createFromAsset, <\/li>\n<li>RoomDatabase.Builder.createFromFile, <\/li>\n<li>RoomDatabase.Builder.createFromInputStream, <\/li>\n<li>RoomDatabase.PrepackagedDatabaseCallback<\/li>\n<\/ul>\n<p>  \u041e\u0431\u0435\u0449\u0430\u043d\u043e \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u2014 \u0436\u0434\u0435\u043c.<\/p>\n<p>  \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u0432\u0435\u0442\u0443\u044e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441\u043e \u0441\u0442\u0430\u0442\u044c\u0435\u0439 <a href=\"https:\/\/johnoreilly.dev\/posts\/jetpack_room_kmp\/\">\u0414\u0436\u043e\u043d\u0430 \u041e&#8217;\u0420\u0435\u0439\u043b\u0438<\/a> \u0438 <a href=\"https:\/\/github.com\/joreilly\/FantasyPremierLeague\/tree\/65b19d32910de7c90b5acd3a477af5c4ece5a595\">\u0435\u0433\u043e \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c<\/a>. <b>\u042f \u0441\u043e\u0432\u0435\u0442\u0443\u044e \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0432 \u043a\u043e\u0434\u0435. \u0427\u0430\u0441\u0442\u044c \u0432\u0430\u0436\u043d\u044b\u0445 \u043d\u044e\u0430\u043d\u0441\u043e\u0432, \u0431\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u0442, \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u0443 \u041e&#8217;\u0420\u0435\u0439\u043b\u0438 \u043d\u0435 \u043e\u0442\u0440\u0430\u0436\u0435\u043d\u0430.<\/b><\/p>\n<p>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u043e\u0441\u0442\u0430\u0432\u0430\u0439\u0442\u0435\u0441\u044c \u043d\u0430 \u0441\u0432\u044f\u0437\u0438)<\/p>\n<p>  <a href=\"https:\/\/developer.android.com\/kotlin\/multiplatform\/sqlite\">developer.android.com\/kotlin\/multiplatform\/sqlite<\/a><br \/>  <a href=\"https:\/\/developer.android.com\/kotlin\/multiplatform\/room\">developer.android.com\/kotlin\/multiplatform\/room<\/a><\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/812453\/\"> https:\/\/habr.com\/ru\/articles\/812453\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/sx\/ju\/9_\/sxju9_erpayx03ib5v8ybxw-0pw.png\" width=\"720\" data-src=\"https:\/\/habrastorage.org\/webt\/sx\/ju\/9_\/sxju9_erpayx03ib5v8ybxw-0pw.png\"\/><br \/>  \u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442! \u041d\u0430 \u0441\u0432\u044f\u0437\u0438 \u0410\u043d\u043d\u0430 \u0416\u0430\u0440\u043a\u043e\u0432\u0430, \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u0433\u0440\u0443\u043f\u043f\u044b \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 Usetech. \u0412 \u043d\u0430\u0447\u0430\u043b\u0435 \u043c\u0430\u044f Google \u043d\u0430\u0441 \u043f\u043e\u0440\u0430\u0434\u043e\u0432\u0430\u043b\u0438 \u0440\u0435\u043b\u0438\u0437\u0430\u043c\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0434\u043b\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449. \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Kotlin Multiplatform \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/developer.android.com\/kotlin\/multiplatform\/room\">Room<\/a> (\u0432\u0435\u0440\u0441\u0438\u044f 2.7.0-alpha01 \u0438 \u0432\u044b\u0448\u0435). <br \/>  \u0418 \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0434\u0430\u043d\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 <a href=\"https:\/\/github.com\/anioutkazharkova\/room-kmp\">\u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Todo<\/a>, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u043d\u0430 KMP \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Compose Multiplatform.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/d3\/cw\/ri\/d3cwrigsmllrygurzuvgqjs0aoq.png\" width=\"540\" data-src=\"https:\/\/habrastorage.org\/webt\/d3\/cw\/ri\/d3cwrigsmllrygurzuvgqjs0aoq.png\"\/><\/p>\n<p>  \u041a\u0440\u043e\u043c\u0435 Room, \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 Lifecycle-viewmodel \u0434\u043b\u044f KMP. \u0418 Koin \u0434\u043b\u044f DI \u0438 \u0433\u0430\u0440\u043c\u043e\u043d\u0438\u0438.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-375478","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/375478","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=375478"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/375478\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=375478"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=375478"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=375478"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}