serviceClass
The traffic characteristics network connections send and receive.
Declaration
final var serviceClass: NWParameters.ServiceClass { get set }Discussion
The serviceClass you use tells the system and compatible networks how to prioritize transmitted packets on Wi-Fi, Ethernet, or cellular for a given connection. Describe whether your traffic favors low latency (for immediacy), or high throughput (for bulk transfers), and the transport may schedule your outgoing packets to reflect that tradeoff.
Use NWParameters.ServiceClass.bestEffort by default. Choose a different class only when you have a specific requirement or measurement showing that another choice improves your results on the networks your app uses.
Certain cellular networks also offer Network Slicing, which can use serviceClass to isolate traffic based on its expected characteristics.
Enabling Network Slicing
There are two steps to enable Cellular Network Slicing:
Set the entitlements in your property list for 5G Network Slicing App Category and 5G Network Slicing Traffic Category. If you don’t entitle your app by specifying both these entitlements, your apps network connections won’t be using Cellular Network Slicing, even if supported by the carrier.
Set this to the appropriate NWParameters.ServiceClass.