https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
n

nrobi

11/06/2019, 7:12 AM
I have the following expected class in my common and I’d like to have different actual db implementations for 🍏 and 🤖. I know, that I can’t expose `Flow`s to iOS. Is there any way to use streams somehow? The only solution I can see currently is to have an abstracted stream, with the actual implementations specified in the platform modules. Any better ideas? 🙏
j

James

11/06/2019, 8:54 AM
How about moving function which using Flow to the android's actual class. For example: internal expect class CategoryLocalSource() { } internal actual class CategoryLocalSource() { fun getCategories(): Flow<List<Category>> fun cacheCategoryList(): Flow<List<Category>> } In this way, you can call getCategories() from Android, but not iOS.
n

nrobi

11/06/2019, 8:57 AM
Yeah, the problem that way is, that I have a
CategoryRepository
in my common module, that’s expecting these functions & streams from the
CategoryLocalSource
2 Views