|
|
|
|
|
by dglass
2832 days ago
|
|
The thing that I still don't know about are how would things like data persistence be handled in a cross platform manner? I recently built a kotlin Android app for work, and our architecture is tightly coupled to Android's Room database and LiveData objects. Obviously if we build it to be cross platform we wouldn't be able to use a Room database or LiveData objects on an iOS device. Would we have to roll our own persistence layer in a cross platform application? Or would we share business logic but still write a persistence layer using platform specific code? It's not just persistence too. Any lower level API provided by the platform would still need to be written twice, right? Accessing the camera, the devices GPS location, or anything hardware related still needs an implementation for both platforms. Or would we eventually see libraries that would abstract this layer out, similar to react native? Edit: Another thought...I haven't done much iOS development but the whole async nature of Android apps with the UI thread and background threads also seems like it would be a nightmare to deal with in a cross platform way. Does iOS involve a lot of async threads? |
|
We are already using libraries to make easier to use background threads (RxJava, RxSwift) so I don't think it's that hard to implement a cross platform lib for that purpose. JetBrains is already trying to tackle the task with Coroutines for Kotlin Native: https://github.com/Kotlin/kotlinx.coroutines/tree/master/nat...