I'm trying to implement a function which returns an AsyncStream of BlurredImage objects. The functions relies on another function sourceImages(), which itself is an AsyncStream.
I get this error on line 2 of my snippet:
Cannot pass function of type '(AsyncStream<BlurredImage>.Continuation) async -> Void' to parameter expecting synchronous function type
What's the correct way to implement this?
func blurredFaces() -> AsyncStream<BlurredImage> {
return AsyncStream<BlurredImage> { continuation in
for await image in sourceImages() {
blurrImage(image) { blurredImage in
continuation.yield(blurredImage)
}
}
continuation.finish()
}
}
func sourceImages() -> AsyncStream<SourceImage> {
...
}
I'm on Xcode 13.4.1