:wave: To use `SharedFlow` on iOS, do we need to u...
# multiplatform
m
👋 To use
SharedFlow
on iOS, do we need to use the
-native-mt
version of kotlinx coroutines ? Same goes with the
Mutex
APIs. Both don’t seem to work using the core version of it. I want to verify this before setting any conclusion. In the docs we set the
common
label against them, would that mean that these are supported in all platforms ?
d
While I think
SharedFlow
itself can work, in general, I found there are definitely
Flow
operators and combinations of them that are incompatible with the 'freezing' memory model in iOS, regardless of whether you use
-mt
or not. I feel it's a bit of a dirty secret that Flows library does not work properly on iOS even if you are careful not to cross thread boundaries in your own code, because internal Coroutines machinery sometimes does so itself, in ways that aren't explicitly documented, causing freezing issues. I found it usable, but I needed to be very selective and experimental about use of
Channels
,
channelFlow
etc. to avoid issues. Thankfully JB decided to implement the new memory model - I wouldn't be surprised if the Flow library issues were a major contributor to that decision. Probably easier than trying to rearchitect the library to work with both models. Maybe you could start trying to use that?
😮 1
today i learned 1
m
I was thinking of that, but that is not production ready yet and our code is already in beta. This can be our plan in few months from now. That is said, this is encouraging me to give the new model a try..so that we can have an idea of the future :)
👍 2
Even though it is known to expect a cost on adopting a new technology such as KMP but it is concerning that certain limitations are not documented.
3