Hi I want to pre-populate the database in my KMM p...
# multiplatform
a
Hi I want to pre-populate the database in my KMM project. I’m using SQLDelight. I have this implementation for the Android side.
Copy code
actual fun Scope.createDriver(): SqlDriver {

    val context = androidContext()
    val fileName = "dbFileName"
    val database: File = context.getDatabasePath(fileName)

    if (!database.exists()) {
        val inputStream = context.assets.open(fileName)
        val outputStream = FileOutputStream(database.absolutePath)

        inputStream.use { input ->
            outputStream.use {
                input.copyTo(it)
            }
        }
    }

    return AndroidSqliteDriver(NoteDatabase.Schema, context, fileName)
}
What are the steps for the iOS side..? thanks!
c
no cross posts please - the answer might be relevant to others and is lost if in the wrong one.
and #squarelibraries is the better channel to ask.