Combine: Networking and the dataTaskPublisher
With this code snippet you will be able use the new dataTaskPublisher in URLSession to handle asynchronous download of data.

This brief overview will demonstrate some basic features that may come in handy when working with publishers in Combine, Apple's framework to handle asynchronous events by combining event-processing operators. The Publisher protocol declares a type that transmits a sequence of values over time that subscribers can receive as input by adopting the Subscriber protocol.
A typical use case for Combine would be handling asynchronous download of data from the internet using a URLSession dataTask. This can be achieved by using the new URLSession.shared.dataTaskPublisher(for: URL)
. Let's have a look.
Become a free member or log in to proceed.