Apple's URL loading system
Apple's URL loading system is a framework of classes available to interact with URLs. We can use these classes to communicate with services that use standard Internet protocols. The classes that we will be using in this section to connect to and retrieve information from REST services are as follows:
URLSession
: This is the main session object.URLSessionConfiguration
: This is used to configure the behavior of theURLSession
object.URLSessionTask
: This is a base class to handle the data being retrieved from the URL. Apple provides three concrete subclasses of theURLSessionTask
class.URL
: This is an object that represents the URL to connect to.URLRequest
: This class contains information about the request that we are making and is used by theURLSessionTask
service to make the request.HTTPURLResponse
: This class contains the response to our request.
Now, let's look at each of these classes a little more in depth so that we have a basic understanding...