Implement databasefactory for iOS
This commit is contained in:
@@ -196,6 +196,7 @@ kotlin {
|
|||||||
// on common by default and will correctly pull the iOS artifacts of any
|
// on common by default and will correctly pull the iOS artifacts of any
|
||||||
// KMP dependencies declared in commonMain.
|
// KMP dependencies declared in commonMain.
|
||||||
implementation(libs.ktor.client.darwin)
|
implementation(libs.ktor.client.darwin)
|
||||||
|
implementation("app.cash.sqldelight:native-driver:2.1.0")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
17
shared/src/iosMain/kotlin/app/klottr/db/DatabaseFactory.kt
Normal file
17
shared/src/iosMain/kotlin/app/klottr/db/DatabaseFactory.kt
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package app.klottr.db
|
||||||
|
|
||||||
|
import app.cash.sqldelight.db.SqlDriver
|
||||||
|
import app.cash.sqldelight.driver.native.NativeSqliteDriver
|
||||||
|
|
||||||
|
/**
|
||||||
|
* iOS-implementation av DatabaseFactory.
|
||||||
|
* Skapar en SqlDriver med NativeSqliteDriver för att köra KlottrDatabase.
|
||||||
|
*/
|
||||||
|
actual object DatabaseFactory {
|
||||||
|
actual fun createDriver(): SqlDriver {
|
||||||
|
return NativeSqliteDriver(
|
||||||
|
schema = KlottrDatabase.Schema,
|
||||||
|
name = "klottr.db"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user