Instance Property


The service type associated with this request.


var networkServiceType: URLRequest.NetworkServiceType { get set }


The network service type provides a hint to the operating system about what the underlying traffic is used for. This hint enhances the system's ability to prioritize traffic, determine how quickly it needs to wake up the cellular or Wi-Fi radio, and so on. It improves the system’s ability to optimally balance battery life, performance, and other considerations.

For example, specify the NSURLRequest.NetworkServiceType.background service type if your app is performing a download that wasn’t requested by the user—like prefetching content so that it’s available when the user chooses to view it. By contrast, continually connected voice and video apps should use the NSURLRequest.NetworkServiceType.voice, NSURLRequest.NetworkServiceType.voip, or video service types, as appropriate.

See Also

Accessing the Service Type

typealias URLRequest.NetworkServiceType

An alias for the network service type.

enum NSURLRequest.NetworkServiceType

The constants used to specify the network service type of a request.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software