Skip to content

Conversation

rickclephas
Copy link
Owner

Only the first emitted value needs to be buffered. Once we have consumed the first value we can wait for a call to Iterator.next before invoking the next callback from Kotlin.
This will make sure that emit in Kotlin suspends until Swift calls Iterator.next to get the next value.

We could even delay the Flow collection until the first call to Iterator.next.
Which would allow us to remove the item buffer completely.
Although in that case we'll need a fatalError for the nil check on continuation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant