Manages network slicing capabilities to control and monitor cellular network traffic routing.
Use `CTSlicingManager` to control how your app's network traffic routes through cellular network slices. Network slicing allows carriers to partition their network resources to provide different levels of service quality for specific types of apps. For example, a gaming slice might prioritize low latency, while a streaming slice focuses on consistent bandwidth. Your app can activate a preferred slice to ensure its traffic receives the appropriate quality of service.
> Important: Network slice availability depends on carrier support, your app's entitlements, and current network conditions. Always check ``availableSliceAppCategories`` before attempting to activate a slice.
Query ``availableSliceAppCategories`` to discover which slice categories your app can use.
```swift
let manager = CTSlicingManager.shared
do {
let categories = try await manager.availableSliceAppCategories
if categories.contains(.gaming) {
// The gaming slice is available.
}
} catch {
// Handle error.
}
```
Activate your preferred slice before creating network connections. New connections automatically route through the activated slice. Call ``activatePreferredSliceForCategory(_:)`` before establishing network connections.
```swift
do {
try await manager.activatePreferredSliceForCategory(.gaming)
// Now establish your network connections
} catch POSIXError.ENOTSUP {
// Network slicing not currently available
} catch {
// Handle other errors.
}
```
Query ``activeSlices`` to verify activation and monitor network slice usage.
```swift
do {
let slices = try await manager.activeSlices
for slice in slices {
print("Category: \(slice.appCategory)")
print("Traffic Class: \(slice.trafficClass)")
print("Interface: \(slice.networkInterfaceName)")
}
} catch {
// Handle error.
}
```
Call ``disableSlicing()`` to return to the default cellular connection when you no longer need slice-specific routing.
```swift
do {
try await manager.disableSlicing()
// New connections now use the default cellular internet
} catch {
// Handle error.
}
```
Members (5)
get · iOS 26.3+
activeSlices
TypeScript
get activeSlices(): Promise<Array<CTSlicingManager_Slice>>
Swift declaration
final var activeSlices: [CTSlicingManager.Slice] { get async throws }
Information about currently active network slices on the device.
This property returns an array of ``Slice`` structures containing detailed information
about each active network slice, including the app category, traffic class, and network interface name.
Use this property to monitor which network slices currently run, and to validate that your preferred slice activates successfully.
```swift
do {
let slices = try await CTSlicingManager.shared.activeSlices
for slice in slices {
print("Active slice:")
print(" Category: \(slice.appCategory.description)")
print(" Traffic Class: \(slice.trafficClass.description)")
print(" Interface: \(slice.networkInterfaceName)")
}
} catch POSIXError.ENOTSUP {
print("Network slicing isn't currently available.")
} catch {
print("Error retrieving active slices: \(error)")
}
```
- Returns: An array of ``Slice`` structures, each containing `appCategory`, `trafficClass`, and `networkInterfaceName`.
- Throws:
- `POSIXError.ENOTSUP` if network slicing is not currently available.
- `POSIXError.EINVAL` if an invalid parameter or system error occurs.
method · iOS 26.3+
disableSlicing
TypeScript
disableSlicing(): Promise<void>
Swift declaration
final func disableSlicing() async throws
Disables network slicing for new connections.
Call this method to stop using network slicing for your app.
After calling this method, new network connections that your app establishes use the carrier's default cellular internet without slice-specific routing.
> Important: This method only affects connections that the system creates after calling it.
Existing active connections that already use a network slice continue to use that slice until the system closes them.
```swift
do {
try await CTSlicingManager.shared.disableSlicing()
// New connections use the default cellular internet.
// Existing connections remain on their current slice.
} catch POSIXError.ENOTSUP {
print("Network slicing operation isn't currently available.")
} catch {
print("Failed to disable slicing: \(error)")
}
```
- Throws:
- `POSIXError.ENOTSUP` if network slicing is not currently available.
- `POSIXError.EINVAL` if an invalid parameter or system error occurs.
get · iOS 26.3+
availableSliceAppCategories
TypeScript
get availableSliceAppCategories(): Promise<Array<CTSlicingManager_AppCategory>>
Swift declaration
final var availableSliceAppCategories: [CTSlicingManager.AppCategory] { get async throws }
Network-slicing app categories available to your app.
This property returns an array of ``AppCategory`` values that meet all of the following requirements:
- The carrier's network supports them.
- Your app's entitlements include them.
- The device and network currently make them available.
Query this property before attempting to activate a specific network slice category to ensure it's available.
```swift
do {
let categories = try await CTSlicingManager.shared.availableSliceAppCategories
print("Available categories: \(categories)")
} catch POSIXError.ENOTSUP {
print("Network slicing isn't currently available")
} catch {
print("Error retrieving categories: \(error)")
}
```
- Throws:
- `POSIXError.ENOTSUP` if network slicing is not currently available.
- `POSIXError.EINVAL` if an invalid parameter or system error occurs.
final func activatePreferredSliceForCategory(_ appCategory: CTSlicingManager.AppCategory) async throws
Activates a preferred network slice for new connections.
Call this method before establishing network connections to route your app's traffic through a specific network slice. After calling this method, new network connections that your app establishes use the specified slice category.
The array that ``availableSliceAppCategories`` returns must include the specified category for activation to succeed.
> Important: This method only affects connections that the system creates after calling it. Existing active connections continue to use their current routing until the system closes them.
```swift
do {
// Activate the gaming slice before starting a multiplayer session.
try await CTSlicingManager.shared.activatePreferredSliceForCategory(.gaming)
// Establish network connections for gaming traffic.
// New connections route through the gaming network slice.
// Existing connections remain on their current routing.
} catch POSIXError.ENOTSUP {
print("Network slicing isn't currently available.")
} catch {
print("Failed to activate slice: \(error)")
}
```
- Parameter appCategory: The ``AppCategory`` to activate. Available categories include:
- `communication`: An app category for communication apps like messaging and voice calls.
- `gaming`: An app category for gaming apps that require low latency and high performance.
- `streaming`: An app category for streaming apps that require high bandwidth and consistent throughput.
- Throws:
- `POSIXError.ENOTSUP` if network slicing is not currently available.
- `POSIXError.EINVAL` if an invalid parameter or system error occurs.
get · iOS 26.3+
shared
TypeScript
static get shared(): CTSlicingManager
Swift declaration
static let shared: CTSlicingManager
A shared singleton instance for accessing network slicing functionality.
Use this shared instance to access all network slicing capabilities.
The `CTSlicingManager` uses a singleton pattern to ensure consistent state management across your app.
```swift
let manager = CTSlicingManager.shared
```