Open jittya opened 6 years ago
This would require major changes, so it's nothing we could do on the fly. Let's see how many people would be interested in this.
I don't think this is an objectbox issue. Objectbox is just an external library for the Android platform and it has to exist within an Android module, nothing can be shared on other platforms with regards to ObjectBox. You can, however, have a local data source interface for your models that will be implemented on each platform separately and ObjectBox will do that for the Android platform.
I don't think this is an objectbox issue. Objectbox is just an external library for the Android platform and it has to exist within an Android module
The 4th item on objectbox.io is "cross platform", and supporting Kotlin/Native would allow using ObjectBox in cross platform projects, which is currently not possible without implementing a higher level abstraction layer.
It does seem like a major change, it would at least require converting all the java classes to kotlin, and in the native implementation, call the C library from kotlin instead of using JNI.
is there an internal branch for this? can we make any contributions?
Any update about this?
Would love to have this
It does seem like a major change, it would at least require converting all the java classes to kotlin, and in the native implementation, call the C library from kotlin instead of using JNI.
Very good observation. Because of that effort, we'll watch how much interest this feature request generates. With our limited resources, we will not start on this immediately though.
There is a theoretic approach using the C API with Kotlin MP, but that is won't be (as) pretty...
It does seem like a major change, it would at least require converting all the java classes to kotlin, and in the native implementation, call the C library from kotlin instead of using JNI.
Very good observation. Because of that effort, we'll watch how much interest this feature request generates. With our limited resources, we will not start on this immediately though.
There is a theoretic approach using the C API with Kotlin MP, but that is won't be (as) pretty...
Has anyone attempted this?
+1
would also like to have this
Any updates for this issue?
Will be great to have this!
It will be great to have support for kmm
Yes please!
+1
+1
In the meantime Kotlin multiplatform gone beta :) Is there any update about support kmm for android and ios?
@ArtemMikhaylov if you want you can try the new https://github.com/realm/realm-kotlin for the time being
@jittyandiyan I checked it out. I used to work with realm in java android app about 2 years ago, and I liked it. But once I queried objects from realm, I used copyFromRealm function on them. So I could work in my logic with them as plane java objects. I like it this way. And it seems like in kotlin Realm for multiplatform it's not an option. So I decided to go with SQLDelight for now.
It's nearly five years, and no progress. Now I realize that it's much better to use either flutter or leave ObjectBox. 😥
You have more alternatives for Multiplatform storage: Realm, Sqldelight, Datastore, Multiplatform Settings... No need for Flutter.
@fcat97 Not Kotlin multi-platform, but ObjectBox is also available for Flutter.
Edit: There is also a helpful Stack Overflow response about this.
Kotlin Multiplatform is now stable. I think, it's a huge opportunity for ObjectBox. Any storage option not supporting Kotlin Multiplatform will probably soon become irrelevant.
I don't understand why it doesn't work. It works with Kotlin and JavaFX on all 3 Windows, Mac & Linux. Now I switch to Compose Multi and something breaks. ToMany & ToOne relationships are completely useless. I have managed to make them persist a little bit but then something breaks. Why is this? There is no hope for longevity. I am just going to have to ditch the relationships entirely since they don't persist. Might be slow but at least it'll work.
Just to clarify for anybody potentially reading this. ObjectBox does in fact work with Compose Multiplatform. It syncs, it persists regular entities and queries everything just fine. The only problem that I'm having is the ToMany & ToOne relationships are not working properly. I keep saving them and then I query them, but there's only 1 entity or none in the ToMany list. You even have to add some extra code for it to even work in the first place like the BoxStore inside the class and you have to attach the entity. It's just so odd. I really hope I can figure something out before switching databases entirely.
@NobilityDeviant This is likely because the bytecode transformer included in the ObjectBox Gradle plugin does not run. It only works for Java JVM or Android projects. See https://docs.objectbox.io/relations#initialization-magic for details and maybe manual steps you can take.
@NobilityDeviant This is likely because the bytecode transformer included in the ObjectBox Gradle plugin does not run. It only works for Java JVM or Android projects. See https://docs.objectbox.io/relations#initialization-magic for details and maybe manual steps you can take.
Sorry i was really upset the other night. I created some abstract entity system on top of objectbox and it turns out it was just my fault for not doing it properly. It's all working well now.
Since Android team is now officially supporting Kotlin Multiplatform for shared business logic, is there going to be any progress towards kotlin multiplatform for ObjectBox?
Note: There is a helpful Stack Overflow response about this.
is there any way that i can use objectbox in kotlin native module and share the bussiness logics in android and ios modules ?