Skip to content

Commit

Permalink
chore : update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jerryOkafor committed Jun 18, 2024
1 parent 7cde1e7 commit a2ec09d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.jerryokafor.core.datastore

import kotlinx.cinterop.ExperimentalForeignApi
import platform.Foundation.NSDocumentDirectory
import platform.Foundation.NSFileManager
import platform.Foundation.NSURL
import platform.Foundation.NSUserDomainMask

@OptIn(ExperimentalForeignApi::class)
fun createDataStore(): UserDataStore =
UserDataStore {
val documentDirectory: NSURL? =
NSFileManager.defaultManager.URLForDirectory(
directory = NSDocumentDirectory,
inDomain = NSUserDomainMask,
appropriateForURL = null,
create = false,
error = null,
)
requireNotNull(documentDirectory).path + "/$dataStoreFileName"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.jerryokafor.core.datastore

import org.koin.dsl.module

fun nativeUserDatastoreModule() = module {
single<UserDataStore> { createDataStore() }
}

0 comments on commit a2ec09d

Please sign in to comment.