Skip to content

0.9.0

Compare
Choose a tag to compare
@xxfast xxfast released this 24 Oct 03:18
· 5 commits to master since this release

What's Changed

New Contributors

Full Changelog: 0.8.0...0.9.0

⚠️ Breaking Changes

  1. Bump kstore to 0.9.0 and remove okio from your dependencies from your libs.version.toml
[versions]
-  kstore = "0.8.0"
+  kstore = "0.9.0"
-  okio = "3.6.0"
  1. If you are using kstore-file, migrate to kotlinx-io's Path from okio's .toPath()
-  import okio.Path.Companion.toPath
+  import kotlinx.io.files.Path 

- val store: KStore<Pet> = storeOf(file = "saved.json".toPath())
+ val store: KStore<Pet> = storeOf(file = Path("saved.json"))
  1. On iOS - Remove the use of experimental DocumentDirectory API, and use NSFileManager directly
-  val filesDir: String = NSFileManager.defaultManager.DocumentDirectory?.relativePath
+  val filesUrl: NSURL? = fileManager.URLForDirectory(
+    directory = NSDocumentDirectory,
+    appropriateForURL = null,
+    create = false,
+    inDomain = NSUserDomainMask,
+    error = null
+  )
+
+  val path: String = requireNotNull(filesUrl?.path) { "Documents directory not found" }

-  val files = filesDirectory.toPath()
+  val files = Path(path)
  1. On Desktop - If you are using harawata/appdirs, make sure to create those directories if they don't already exist. The store won't create them for you
+  val filesDir: String = AppDirsFactory.getInstance()
+    .getUserDataDir("io.github.xxfast.nytimes", "1.0.0", "xxfast") // or whereever

+  val path = Path(filesDir)
+  with(SystemFileSystem) { if(!exists(path)) createDirectories(path) }

val store: KStore<Pet> = storeOf(file = path)

Example Migration

xxfast/NYTimes-KMP@6eaa4a1

Full Documentation

https://xxfast.github.io/KStore/overview.html