Created
October 17, 2023 17:27
-
-
Save igorescodro/887de513c6c29d9380d9a6def4091bdf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@OptIn(ExperimentalForeignApi::class) | |
fun getDataStore(): DataStore<Preferences> = getDataStore( | |
producePath = { | |
val documentDirectory: NSURL? = NSFileManager.defaultManager.URLForDirectory( | |
directory = NSDocumentDirectory, | |
inDomain = NSUserDomainMask, | |
appropriateForURL = null, | |
create = false, | |
error = null, | |
) | |
requireNotNull(documentDirectory).path + "/$dataStoreFileName" | |
}, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment