withValue(_:operation:)

Convenience API to bind the task-local current to the passed value, and execute the passed operation.

ServiceContext.swift:243
iOS
13.0+
macOS
10.15+
tvOS
13.0+
watchOS
6.0+
static func withValue<T>(_ value: ServiceContext?, operation: () throws -> T) rethrows -> T

To access the task-local value, use ServiceContext.current.

SeeAlso: Swift Task Locals