Peter Hsu
07/05/2024, 9:31 PMFor-in loop requires 'SkieKotlinFlow<T>' to conform to 'AsyncSequence'
Tadeas Kriz
07/05/2024, 9:35 PMSkieSwiftFlow<T>
)Peter Hsu
07/05/2024, 9:39 PMinterface Model<TViewState :ViewState> {
val viewState: Flow<TViewState>
val navigationEventFlow: Flow<NavigationEvent>
}
interface NavigationEvent
interface ViewState
Peter Hsu
07/05/2024, 9:39 PMTask.init {
for await awaitedValue in model.navigationEventFlow {
// do something
}
}
Tadeas Kriz
07/05/2024, 9:45 PMmodel
used in Swift?Tadeas Kriz
07/05/2024, 9:45 PMPeter Hsu
07/05/2024, 9:47 PMTadeas Kriz
07/05/2024, 9:47 PMmodel
property?Tadeas Kriz
07/05/2024, 9:48 PMSkieKotlinFlow
and not SkieSwiftFlow
is really weird (either a known limitation that @Filip Dolník might remember, or possibly a bug)Tadeas Kriz
07/05/2024, 9:49 PMfor await awaitedValue in SkieSwiftFlow(model.navigationEventFlow)
Peter Hsu
07/07/2024, 6:51 AMSkieSwiftFlow
- am I missing an import? It doesn't exist in the header for the generated frameworkPeter Hsu
07/07/2024, 6:54 AMmodel
property is of CommonModel
, which is an interface that extends the Model
interface I mentioned above. On the swift side, it's a CommonModel
being referenced. The models do have a few generic types associated with it, not sure if that's relevantFilip Dolník
07/08/2024, 9:41 AMSkieSwiftFlow
- am I missing an import? It doesn’t exist in the header for the generated framework
It should be enough to import your Kotlin framework. The SkieSwiftFlow is written in Swift so it’s not present in the Obj-C header - only in the Swift header.
> The models do have a few generic types associated with it, not sure if that’s relevant
It’s possible. The translation from SkieKotlinFlow to SkieSwiftFlow is done automatically by the Swift compiler and there are some cases in which it’s not possible to do, mainly if the Flow is a type argument (generics)
In the following example:
for await awaitedValue in model.navigationEventFlow {
// do something
}
What is the exact type of model
and model.navigationEventFlow
expressions?