I’m using KMM library in my project. I want to access local json files in both iOS and Android from shared resources. I don’t want to use files from iOS App.
I have written following code in shared/src/commonMain/iOSMain but its not working
val bundle = NSBundle.mainBundle
val path = bundle.pathForResource(name = "sample2", ofType = "json") ?: "File not found"
I have put my json files in commonMain/resources/sample2.json
I have also try by putting it in commonMain/resources/iOSMain/sample2.json Still its not working.
Any suggestions?
We have also tried using compose resources inside CommonMain folder depicted in official JetBrains website but not working for iOS
bytes = Res.readBytes("files/$locale.json").decodeToString()