Flow hierarchy and why optional flow types? #86
Replies: 1 comment 3 replies
-
Hi!
Even though SKIE knows about the nullability (which is how it can determine which of the two classes to use), it has to pass that nullability information to Swift somehow. The reason why using the two classes is the only way to do so is complicated. The simplified explanation is that you cannot write something like
Because the SkieSwiftStateFlow is a final class (and it must be due to how Objective-C bridging works). Therefore, you can't inherit from it.
Can you please share an example of the wrapper? I'm not sure what you mean. If you want to instantiate flows from Swift, you should be able to use regular Kotlin functions like |
Beta Was this translation helpful? Give feedback.
-
Since the SKIE plugin knows about nullability, why does it need separate classes for nullable/optional flows? Internally it can still track if the original type was nullable or not and treat it accordingly. This seems like unnecessary complication.
Also, why doesn't
SkieSwiftMutableStateFlow
inherit fromSkieSwiftStateFlow
? This would make it easier for Swift code to instantiate aMutableStateFlow
and pass that to Kotlin (which might only expect aStateFlow
).And why isn't there any built-in mechanism to instantiate flows? We had to create our own wrapper class.
Beta Was this translation helpful? Give feedback.
All reactions