Streaming response with URLSession

Hi, I'm writing an addendum and using the API in it. This API has a function of response with fragments (it's about imaging text). I need to implement the display of each part of the response of the server to form the overall response. I have already implemented POST write to the server using URLSession.shared.dataTask(with: request), but for better interaction, I need to show the generation of the response which is made up of pieces of the overall response. Help me implement (or direct me to learn more about Streaming response with (or without) SwiftUI using Swift)
Answered by Claude31 in 661755022
Not sure to understand exactly what you want, but looks like dispatchGroup could be useful there.

I found those tutorials well done about it:
https ://www.raywenderlich. com/5370-grand-central-dispatch-tutorial-for-swift-4-part-1-2 
https ://www.raywenderlich. com/5371-grand-central-dispatch-tutorial-for-swift-4-part-2-2

Hope that helps. If so, don't forget to close the thread.
Accepted Answer
Not sure to understand exactly what you want, but looks like dispatchGroup could be useful there.

I found those tutorials well done about it:
https ://www.raywenderlich. com/5370-grand-central-dispatch-tutorial-for-swift-4-part-1-2 
https ://www.raywenderlich. com/5371-grand-central-dispatch-tutorial-for-swift-4-part-2-2

Hope that helps. If so, don't forget to close the thread.
Streaming response with URLSession
 
 
Q