### Unchecked Sendable Conformance Example Source: https://developer.apple.com/documentation/swift/unsafesendable Example of how to use an unchecked conformance to Sendable for a custom structure. This is the recommended alternative to UnsafeSendable. ```swift struct MyStructure: @unchecked Sendable { ... } ``` -------------------------------- ### Demonstrate Concurrency Capture Error Source: https://developer.apple.com/documentation/swift/sendablemetatype An example showing how capturing a non-Sendable metatype in a concurrent task causes a compiler error. ```swift protocol P { static func f() } func useFromAnotherTask(_: T.Type) { Task { @concurrent in T.f() // error: capturing non-Sendable type `T.Type` in a concurrently-executing task } } ``` -------------------------------- ### Define Isolated Conformance Source: https://developer.apple.com/documentation/swift/sendablemetatype An example of a class with an isolated conformance to a protocol. ```swift @MainActor class MyModel: @MainActor P { /* implicitly @MainActor */ static func f() { /* on the main actor */ } } useFromAnotherTask(MyModel.self) ``` -------------------------------- ### MainActor Instance Methods Source: https://developer.apple.com/documentation/swift/mainactor Details the instance methods available on the MainActor. ```APIDOC ## Instance Methods ### `func enqueue(UnownedJob)` ``` -------------------------------- ### Basic Type Conformance Source: https://developer.apple.com/documentation/swift/sendablemetatype Lists basic Swift types and their associated conformances. ```APIDOC ## Basic Type Conformance ### Description This section lists various basic Swift types and their associated conformance requirements. ### Types and Conformances - **`DistributedActorCodingError`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`Double`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`Double.SIMD16Storage`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`Double.SIMD2Storage`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`Double.SIMD32Storage`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`Double.SIMD4Storage`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`Double.SIMD64Storage`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`Double.SIMD8Storage`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`Duration`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`Duration.TimeFormatStyle`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`Duration.TimeFormatStyle.Attributed`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`Duration.TimeFormatStyle.Pattern`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`Duration.UnitsFormatStyle`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`Duration.UnitsFormatStyle.Attributed`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`Duration.UnitsFormatStyle.FractionalPartDisplayStrategy`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`Duration.UnitsFormatStyle.Unit`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`Duration.UnitsFormatStyle.UnitWidth`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`Duration.UnitsFormatStyle.ZeroValueUnitsDisplayStrategy`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`EncodingError`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`EncodingError.Context`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`ExecuteDistributedTargetError`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`ExecutorJob`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`Float`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`Float.SIMD16Storage`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`Float.SIMD2Storage`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`Float.SIMD32Storage`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`Float.SIMD4Storage`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`Float.SIMD64Storage`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`Float.SIMD8Storage`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`Float16`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`Float16.SIMD16Storage`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`Float16.SIMD2Storage`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`Float16.SIMD32Storage`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`Float16.SIMD4Storage`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`Float16.SIMD64Storage`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`Float16.SIMD8Storage`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`Float80`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`FloatingPointClassification`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`FloatingPointRoundingRule`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`FloatingPointSign`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`Hasher`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`Int`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int.SIMD16Storage`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int.SIMD2Storage`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int.SIMD32Storage`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int.SIMD4Storage`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int.SIMD64Storage`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int.SIMD8Storage`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int.Words`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int128`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int16`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int16.SIMD16Storage`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int16.SIMD2Storage`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int16.SIMD32Storage`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int16.SIMD4Storage`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int16.SIMD64Storage`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int16.SIMD8Storage`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int16.Words`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int32`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int32.SIMD16Storage`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int32.SIMD2Storage`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int32.SIMD32Storage`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int32.SIMD4Storage`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int32.SIMD64Storage`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int32.SIMD8Storage`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int32.Words`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int64`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int64.SIMD16Storage`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int64.SIMD2Storage`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int64.SIMD32Storage`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int64.SIMD4Storage`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int64.SIMD64Storage`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int64.SIMD8Storage`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int64.Words`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int8`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int8.SIMD16Storage`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int8.SIMD2Storage`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int8.SIMD32Storage`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int8.SIMD4Storage`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int8.SIMD64Storage`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int8.SIMD8Storage`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Int8.Words`**: Conforms when `Element` conforms to `Escapable` and `Sendable`. - **`Job`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`JobPriority`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. - **`KeyValuePairs`**: Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### Swift Time API Overview Source: https://developer.apple.com/documentation/swift/time-and-duration Overview of the core protocols and structures for time measurement in Swift. ```APIDOC ## Swift Time API ### Description The Time library provides tools to measure operation duration and schedule future tasks. ### Clocks - **Clock** (protocol) - A mechanism to measure time and delay work. - **ContinuousClock** (struct) - Measures time that increments even while the system is asleep. - **SuspendingClock** (struct) - Measures time that stops incrementing while the system is asleep. ### Durations - **Duration** (struct) - A representation of high-precision time. - **DurationProtocol** (protocol) - Defines a duration for a given InstantProtocol type. ### Supporting Types - **InstantProtocol** (protocol) - Defines a point in time. ``` -------------------------------- ### MainActor Instance Properties Source: https://developer.apple.com/documentation/swift/mainactor Details the instance properties available on the MainActor. ```APIDOC ## Instance Properties ### `var unownedExecutor: UnownedSerialExecutor` Retrieve the executor for this actor as an optimized, unowned reference. ``` -------------------------------- ### MainActor Conformance Source: https://developer.apple.com/documentation/swift/mainactor Lists the protocols that the MainActor conforms to. ```APIDOC ## Conforms To * `Actor` * `GlobalActor` * `Sendable` * `SendableMetatype` ``` -------------------------------- ### AsyncFlatMapSequence Conformance Source: https://developer.apple.com/documentation/swift/sendablemetatype Details the conformance requirements for AsyncFlatMapSequence. ```APIDOC ## AsyncFlatMapSequence ### Description Conforms when `Base` conforms to `Sendable`, `Base` conforms to `AsyncSequence`, `SegmentOfResult` conforms to `Sendable`, `SegmentOfResult` conforms to `AsyncSequence`, `Base.Element` conforms to `Sendable`, and `SegmentOfResult.Element` conforms to `Sendable`. ### Conformance Requirements - **Base** (Type) - Conforms to `Sendable` - Conforms to `AsyncSequence` - **SegmentOfResult** (Type) - Conforms to `Sendable` - Conforms to `AsyncSequence` - **Base.Element** (Type) - Conforms to `Sendable` - **SegmentOfResult.Element** (Type) - Conforms to `Sendable` ``` -------------------------------- ### MainActor Class Overview Source: https://developer.apple.com/documentation/swift/mainactor Provides an overview of the MainActor class, its purpose, and supported platforms. ```APIDOC ## MainActor A singleton actor whose executor is equivalent to the main dispatch queue. iOS 13.0+ iPadOS 13.0+ Mac Catalyst 13.0+ macOS 10.15+ tvOS 13.0+ visionOS 1.0+ watchOS 6.0+ ```swift @globalActor final actor MainActor ``` ``` -------------------------------- ### AsyncDropFirstSequence Conformance Source: https://developer.apple.com/documentation/swift/sendablemetatype Details the conformance requirements for AsyncDropFirstSequence. ```APIDOC ## AsyncDropFirstSequence ### Description Conforms when `Base` conforms to `Sendable`, `Base` conforms to `AsyncSequence`, and `Base.Element` conforms to `Sendable`. ### Conformance Requirements - **Base** (Type) - Conforms to `Sendable` - Conforms to `AsyncSequence` - **Base.Element** (Type) - Conforms to `Sendable` ``` -------------------------------- ### MainActor Type Methods Source: https://developer.apple.com/documentation/swift/mainactor Details the static methods available on the MainActor. ```APIDOC ## Type Methods ### `static func assumeIsolated(() throws -> T, file: StaticString, line: UInt) rethrows -> T` Assume that the current task is executing on the main actor’s serial executor, or stop program execution. ### `static func run(resultType: T.Type, body: () throws -> T) async rethrows -> T` Execute the given body closure on the main actor. ``` -------------------------------- ### AsyncPrefixSequence Conformance Source: https://developer.apple.com/documentation/swift/sendablemetatype Details the conformance requirements for AsyncPrefixSequence. ```APIDOC ## AsyncPrefixSequence ### Description Conforms when `Base` conforms to `Sendable`, `Base` conforms to `AsyncSequence`, and `Base.Element` conforms to `Sendable`. ### Conformance Requirements - **Base** (Type) - Conforms to `Sendable` - Conforms to `AsyncSequence` - **Base.Element** (Type) - Conforms to `Sendable` ``` -------------------------------- ### AsyncStream.Continuation.BufferingPolicy Conformance Source: https://developer.apple.com/documentation/swift/sendablemetatype Details the conformance requirements for AsyncStream.Continuation.BufferingPolicy. ```APIDOC ## AsyncStream.Continuation.BufferingPolicy ### Description This type does not have explicit conformance requirements listed in the provided text. ``` -------------------------------- ### AsyncFlatMapSequence.Iterator Conformance Source: https://developer.apple.com/documentation/swift/sendablemetatype Details the conformance requirements for the Iterator of AsyncFlatMapSequence. ```APIDOC ## AsyncFlatMapSequence.Iterator ### Description Conforms when `Base` conforms to `AsyncSequence`, `SegmentOfResult` conforms to `Sendable`, `SegmentOfResult` conforms to `AsyncSequence`, `Base.AsyncIterator` conforms to `Sendable`, `Base.Element` conforms to `Sendable`, `SegmentOfResult.AsyncIterator` conforms to `Sendable`, and `SegmentOfResult.Element` conforms to `Sendable`. ### Conformance Requirements - **Base** (Type) - Conforms to `AsyncSequence` - **SegmentOfResult** (Type) - Conforms to `Sendable` - Conforms to `AsyncSequence` - **Base.AsyncIterator** (Type) - Conforms to `Sendable` - **Base.Element** (Type) - Conforms to `Sendable` - **SegmentOfResult.AsyncIterator** (Type) - Conforms to `Sendable` - **SegmentOfResult.Element** (Type) - Conforms to `Sendable` ``` -------------------------------- ### AsyncPrefixSequence.Iterator Conformance Source: https://developer.apple.com/documentation/swift/sendablemetatype Details the conformance requirements for the Iterator of AsyncPrefixSequence. ```APIDOC ## AsyncPrefixSequence.Iterator ### Description Conforms when `Base` conforms to `AsyncSequence`, `Base.AsyncIterator` conforms to `Sendable`, and `Base.Element` conforms to `Sendable`. ### Conformance Requirements - **Base** (Type) - Conforms to `AsyncSequence` - **Base.AsyncIterator** (Type) - Conforms to `Sendable` - **Base.Element** (Type) - Conforms to `Sendable` ``` -------------------------------- ### AsyncStream.Continuation Conformance Source: https://developer.apple.com/documentation/swift/sendablemetatype Details the conformance requirements for AsyncStream.Continuation. ```APIDOC ## AsyncStream.Continuation ### Description This type does not have explicit conformance requirements listed in the provided text. ``` -------------------------------- ### AsyncStream.Continuation.Termination Conformance Source: https://developer.apple.com/documentation/swift/sendablemetatype Details the conformance requirements for AsyncStream.Continuation.Termination. ```APIDOC ## AsyncStream.Continuation.Termination ### Description This type does not have explicit conformance requirements listed in the provided text. ``` -------------------------------- ### AsyncPrefixWhileSequence Conformance Source: https://developer.apple.com/documentation/swift/sendablemetatype Details the conformance requirements for AsyncPrefixWhileSequence. ```APIDOC ## AsyncPrefixWhileSequence ### Description Conforms when `Base` conforms to `Sendable`, `Base` conforms to `AsyncSequence`, and `Base.Element` conforms to `Sendable`. ### Conformance Requirements - **Base** (Type) - Conforms to `Sendable` - Conforms to `AsyncSequence` - **Base.Element** (Type) - Conforms to `Sendable` ``` -------------------------------- ### MainActor Type Properties Source: https://developer.apple.com/documentation/swift/mainactor Details the static properties available on the MainActor. ```APIDOC ## Type Properties ### `static let shared: MainActor` The shared actor instance that will be used to provide mutually-exclusive access to declarations annotated with the given global actor type. ### `static var sharedUnownedExecutor: UnownedSerialExecutor` Shorthand for referring to the `shared.unownedExecutor` of this global actor. ``` -------------------------------- ### AsyncDropFirstSequence.Iterator Conformance Source: https://developer.apple.com/documentation/swift/sendablemetatype Details the conformance requirements for the Iterator of AsyncDropFirstSequence. ```APIDOC ## AsyncDropFirstSequence.Iterator ### Description Conforms when `Base` conforms to `AsyncSequence`, `Base.AsyncIterator` conforms to `Sendable`, and `Base.Element` conforms to `Sendable`. ### Conformance Requirements - **Base** (Type) - Conforms to `AsyncSequence` - **Base.AsyncIterator** (Type) - Conforms to `Sendable` - **Base.Element** (Type) - Conforms to `Sendable` ``` -------------------------------- ### EmptyCollection Conformance Source: https://developer.apple.com/documentation/swift/sendablemetatype Details the conformance requirements for EmptyCollection. ```APIDOC ## EmptyCollection Conformance ### Description Conforms when `Element` conforms to `Copyable` and `Escapable`. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### AsyncStream.Continuation.YieldResult Conformance Source: https://developer.apple.com/documentation/swift/sendablemetatype Details the conformance requirements for AsyncStream.Continuation.YieldResult. ```APIDOC ## AsyncStream.Continuation.YieldResult ### Description Conforms when `Element` conforms to `Copyable`, `Escapable`, and `Sendable`. ### Conformance Requirements - **Element** (Type) - Conforms to `Copyable` - Conforms to `Escapable` - Conforms to `Sendable` ``` -------------------------------- ### EmptyCollection.Iterator Conformance Source: https://developer.apple.com/documentation/swift/sendablemetatype Details the conformance requirements for EmptyCollection.Iterator. ```APIDOC ## EmptyCollection.Iterator Conformance ### Description Conforms when `Element` conforms to `Copyable` and `Escapable`. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### AsyncMapSequence Conformance Source: https://developer.apple.com/documentation/swift/sendablemetatype Details the conformance requirements for AsyncMapSequence. ```APIDOC ## AsyncMapSequence ### Description Conforms when `Base` conforms to `Sendable`, `Base` conforms to `AsyncSequence`, `Transformed` conforms to `Copyable`, `Transformed` conforms to `Escapable`, `Transformed` conforms to `Sendable`, and `Base.Element` conforms to `Sendable`. ### Conformance Requirements - **Base** (Type) - Conforms to `Sendable` - Conforms to `AsyncSequence` - **Transformed** (Type) - Conforms to `Copyable` - Conforms to `Escapable` - Conforms to `Sendable` - **Base.Element** (Type) - Conforms to `Sendable` ``` -------------------------------- ### AsyncThrowingCompactMapSequence Conformance Source: https://developer.apple.com/documentation/swift/sendablemetatype Details the conformance requirements for AsyncThrowingCompactMapSequence. ```APIDOC ## AsyncThrowingCompactMapSequence ### Description Conforms when `Base` conforms to `Sendable`, `Base` conforms to `AsyncSequence`, `ElementOfResult` conforms to `Copyable`, `ElementOfResult` conforms to `Escapable`, and `Base.Element` conforms to `Sendable`. ### Conformance Requirements - **Base** (Type) - Conforms to `Sendable` - Conforms to `AsyncSequence` - **ElementOfResult** (Type) - Conforms to `Copyable` - Conforms to `Escapable` - **Base.Element** (Type) - Conforms to `Sendable` ``` -------------------------------- ### AsyncPrefixWhileSequence.Iterator Conformance Source: https://developer.apple.com/documentation/swift/sendablemetatype Details the conformance requirements for the Iterator of AsyncPrefixWhileSequence. ```APIDOC ## AsyncPrefixWhileSequence.Iterator ### Description Conforms when `Base` conforms to `AsyncSequence`, `Base.AsyncIterator` conforms to `Sendable`, and `Base.Element` conforms to `Sendable`. ### Conformance Requirements - **Base** (Type) - Conforms to `AsyncSequence` - **Base.AsyncIterator** (Type) - Conforms to `Sendable` - **Base.Element** (Type) - Conforms to `Sendable` ``` -------------------------------- ### Strings and Characters Source: https://developer.apple.com/documentation/swift/strings-and-text Learn how to work with String and Character types in Swift for Unicode-safe text manipulation. ```APIDOC ## Strings and Characters ### Description `struct String` represents a Unicode string value, which is a collection of characters. `struct Character` represents a single extended grapheme cluster, approximating a user-perceived character. ### Topics - Strings and Characters - Regular Expressions - Encoding and Storage - Compile-Time Strings ``` -------------------------------- ### DropFirstSequence Conformance Source: https://developer.apple.com/documentation/swift/sendablemetatype Details the conformance requirements for DropFirstSequence. ```APIDOC ## DropFirstSequence Conformance ### Description Conforms when `Base` conforms to `Sendable` and `Sequence`. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### AsyncCompactMapSequence Conformance Source: https://developer.apple.com/documentation/swift/sendablemetatype Details the conformance requirements for AsyncCompactMapSequence. ```APIDOC ## AsyncCompactMapSequence ### Description Conforms when `Base` conforms to `Sendable`, `Base` conforms to `AsyncSequence`, `ElementOfResult` conforms to `Copyable`, `ElementOfResult` conforms to `Escapable`, `ElementOfResult` conforms to `Sendable`, and `Base.Element` conforms to `Sendable`. ### Conformance Requirements - **Base** (Type) - Conforms to `Sendable` - Conforms to `AsyncSequence` - **ElementOfResult** (Type) - Conforms to `Copyable` - Conforms to `Escapable` - Conforms to `Sendable` - **Base.Element** (Type) - Conforms to `Sendable` ``` -------------------------------- ### Resume continuation with a Result Source: https://developer.apple.com/documentation/swift/unsafecontinuation Resumes the task awaiting the continuation by providing a Result, which can be either a success value or an error. This method encapsulates both success and failure outcomes. ```swift func resume(with: sending Result) ``` -------------------------------- ### Regular Expressions Source: https://developer.apple.com/documentation/swift/strings-and-text Explore the Regex API in Swift for pattern matching and text manipulation using regular expressions. ```APIDOC ## Regular Expressions ### Description Swift provides a `Regex` struct for working with regular expressions. This includes types for specifying repetition behavior (`RegexRepetitionBehavior`), semantic matching levels (`RegexSemanticLevel`), word boundary kinds (`RegexWordBoundaryKind`), and type-erased regex output (`AnyRegexOutput`). The `RegexComponent` protocol defines types that can be part of a regular expression. ### Types - `struct Regex`: Represents a regular expression. - `struct RegexRepetitionBehavior`: Specifies quantifier matching behavior. - `struct RegexSemanticLevel`: Defines semantic level for regex matching. - `struct RegexWordBoundaryKind`: Algorithm for word boundary matching. - `struct AnyRegexOutput`: Type-erased output of a regex match. - `protocol RegexComponent`: Represents a component of a regular expression. - `protocol CustomConsumingRegexComponent` ``` -------------------------------- ### AsyncDropWhileSequence Conformance Source: https://developer.apple.com/documentation/swift/sendablemetatype Details the conformance requirements for AsyncDropWhileSequence. ```APIDOC ## AsyncDropWhileSequence ### Description Conforms when `Base` conforms to `Sendable`, `Base` conforms to `AsyncSequence`, and `Base.Element` conforms to `Sendable`. ### Conformance Requirements - **Base** (Type) - Conforms to `Sendable` - Conforms to `AsyncSequence` - **Base.Element** (Type) - Conforms to `Sendable` ``` -------------------------------- ### AsyncThrowingCompactMapSequence.Iterator Conformance Source: https://developer.apple.com/documentation/swift/sendablemetatype Details the conformance requirements for the Iterator of AsyncThrowingCompactMapSequence. ```APIDOC ## AsyncThrowingCompactMapSequence.Iterator ### Description Conforms when `Base` conforms to `AsyncSequence`, `ElementOfResult` conforms to `Copyable`, `ElementOfResult` conforms to `Escapable`, `Base.AsyncIterator` conforms to `Sendable`, and `Base.Element` conforms to `Sendable`. ### Conformance Requirements - **Base** (Type) - Conforms to `AsyncSequence` - **ElementOfResult** (Type) - Conforms to `Copyable` - Conforms to `Escapable` - **Base.AsyncIterator** (Type) - Conforms to `Sendable` - **Base.Element** (Type) - Conforms to `Sendable` ``` -------------------------------- ### Dictionary.Values.Iterator Conformance Source: https://developer.apple.com/documentation/swift/sendablemetatype Details the conformance requirements for Dictionary.Values.Iterator. ```APIDOC ## Dictionary.Values.Iterator Conformance ### Description Conforms when `Key` conforms to `Hashable`, `Key` conforms to `Sendable`, `Value` conforms to `Copyable`, `Value` conforms to `Escapable`, and `Value` conforms to `Sendable`. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### Encoding and Storage Source: https://developer.apple.com/documentation/swift/strings-and-text Utilities for handling Unicode encoding and storage in Swift. ```APIDOC ## Encoding and Storage ### Description The `Unicode` enum provides a namespace for various utilities related to Unicode encoding and storage in Swift. ``` -------------------------------- ### Compile-Time Strings Source: https://developer.apple.com/documentation/swift/strings-and-text Utilize `StaticString` for strings known at compile time in Swift. ```APIDOC ## Compile-Time Strings ### Description `struct StaticString` is a string type designed to represent text that is known at compile time, offering potential performance benefits. ``` -------------------------------- ### Array Conformance Source: https://developer.apple.com/documentation/swift/sendablemetatype Details the conformance requirements for the Array type. ```APIDOC ## Array ### Description Conforms when `Element` conforms to `Copyable`, `Escapable`, and `Sendable`. ### Conformance Requirements - **Element** (Type) - Conforms to `Copyable` - Conforms to `Escapable` - Conforms to `Sendable` ``` -------------------------------- ### AsyncFilterSequence Conformance Source: https://developer.apple.com/documentation/swift/sendablemetatype Details the conformance requirements for AsyncFilterSequence. ```APIDOC ## AsyncFilterSequence ### Description Conforms when `Base` conforms to `Sendable`, `Base` conforms to `AsyncSequence`, and `Base.Element` conforms to `Sendable`. ### Conformance Requirements - **Base** (Type) - Conforms to `Sendable` - Conforms to `AsyncSequence` - **Base.Element** (Type) - Conforms to `Sendable` ``` -------------------------------- ### withUnsafeContinuation(isolation:_:) Function Source: https://developer.apple.com/documentation/swift/withunsafecontinuation%28isolation%3A_%3A%29 Invokes a closure with an unsafe continuation for the current task, allowing manual control over task suspension and resumption. ```APIDOC ## Function: withUnsafeContinuation(isolation:_:) ### Description Invokes the passed in closure with an unsafe continuation for the current task. The body of the closure executes synchronously on the calling task, and once it returns, the calling task is suspended until the continuation is resumed. ### Signature ```swift func withUnsafeContinuation( isolation: isolated (any Actor)? = #isolation, _ fn: (UnsafeContinuation) -> Void ) async -> sending T ``` ### Parameters - **isolation** (isolated (any Actor)?) - Optional - The actor isolation for the closure. - **fn** ((UnsafeContinuation) -> Void) - Required - A closure that takes an UnsafeContinuation parameter. You must invoke the continuation’s resume method exactly once. ### Return Value - **T** - The value the continuation is resumed with. ### Discussion Unlike the 'checked' continuation variant, the UnsafeContinuation does not detect or diagnose misuse, such as calling resume twice or forgetting to call it. Failure to resume the continuation will cause the calling task to remain suspended indefinitely. ``` -------------------------------- ### Related Concurrency Concepts Source: https://developer.apple.com/documentation/swift/unsafesendable Lists and describes related Swift concurrency protocols and types. ```APIDOC ### See Also #### Actors - `protocol Sendable` A thread-safe type whose values can be shared across arbitrary concurrent contexts without introducing a risk of data races. - `protocol Actor` Common protocol to which all actors conform. - `typealias AnyActor` Common marker protocol providing a shared “base” for both (local) `Actor` and (potentially remote) `DistributedActor` types. - `actor MainActor` A singleton actor whose executor is equivalent to the main dispatch queue. - `protocol GlobalActor` A type that represents a globally-unique actor that can be used to isolate various declarations anywhere in the program. - `protocol SendableMetatype` A type whose metatype can be shared across arbitrary concurrent contexts without introducing a risk of data races. #### Deprecated - `typealias ConcurrentValue` - `typealias UnsafeConcurrentValue` - `macro isolation() -> T` Produce a reference to the actor to which the enclosing code is isolated, or `nil` if the code is nonisolated. - `func extractIsolation((repeat each Arg) async throws -> Result) -> (any Actor)?` ``` -------------------------------- ### ArraySlice Conformance Source: https://developer.apple.com/documentation/swift/sendablemetatype Details the conformance requirements for the ArraySlice type. ```APIDOC ## ArraySlice ### Description Conforms when `Element` conforms to `Copyable`, `Escapable`, and `Sendable`. ### Conformance Requirements - **Element** (Type) - Conforms to `Copyable` - Conforms to `Escapable` - Conforms to `Sendable` ``` -------------------------------- ### FlattenSequence.Index Conformance Source: https://developer.apple.com/documentation/swift/sendablemetatype Details the conformance requirements for FlattenSequence.Index. ```APIDOC ## FlattenSequence.Index Conformance ### Description Conforms when `Base` conforms to `Collection`, `Base.Element` conforms to `Collection`, `Base.Index` conforms to `Sendable`, and `Base.Element.Index` conforms to `Sendable`. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### JoinedSequence Conformance Source: https://developer.apple.com/documentation/swift/sendablemetatype Details the conformance requirements for JoinedSequence. ```APIDOC ## JoinedSequence Conformance ### Description Conforms when `Base` conforms to `Sendable`, `Base` conforms to `Sequence`, `Base.Element` conforms to `Sequence`, and `Base.Element.Element` conforms to `Sendable`. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### IndexingIterator Conformance Source: https://developer.apple.com/documentation/swift/sendablemetatype Details the conformance requirements for IndexingIterator. ```APIDOC ## IndexingIterator Conformance ### Description Conforms when `Elements` conforms to `Collection`, `Elements` conforms to `Sendable`, and `Elements.Index` conforms to `Sendable`. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### AsyncMapSequence.Iterator Conformance Source: https://developer.apple.com/documentation/swift/sendablemetatype Details the conformance requirements for the Iterator of AsyncMapSequence. ```APIDOC ## AsyncMapSequence.Iterator ### Description Conforms when `Base` conforms to `AsyncSequence`, `Transformed` conforms to `Copyable`, `Transformed` conforms to `Escapable`, `Transformed` conforms to `Sendable`, `Base.AsyncIterator` conforms to `Sendable`, and `Base.Element` conforms to `Sendable`. ### Conformance Requirements - **Base** (Type) - Conforms to `AsyncSequence` - **Transformed** (Type) - Conforms to `Copyable` - Conforms to `Escapable` - Conforms to `Sendable` - **Base.AsyncIterator** (Type) - Conforms to `Sendable` - **Base.Element** (Type) - Conforms to `Sendable` ``` -------------------------------- ### AsyncStream Conformance Source: https://developer.apple.com/documentation/swift/sendablemetatype Details the conformance requirements for AsyncStream. ```APIDOC ## AsyncStream ### Description Conforms when `Element` conforms to `Copyable`, `Escapable`, and `Sendable`. ### Conformance Requirements - **Element** (Type) - Conforms to `Copyable` - Conforms to `Escapable` - Conforms to `Sendable` ``` -------------------------------- ### Related Continuations Source: https://developer.apple.com/documentation/swift/unsafethrowingcontinuation Provides documentation for related continuation types and functions, including CheckedContinuation and UnsafeContinuation, and their associated functions for interfacing between synchronous and asynchronous code. ```APIDOC ## See Also ### Continuations #### `struct CheckedContinuation` ##### Description A mechanism to interface between synchronous and asynchronous code, logging correctness violations. ##### Function: `withCheckedContinuation` - **Signature**: `func withCheckedContinuation(isolation: isolated (any Actor)?, function: String, (CheckedContinuation) -> Void) async -> sending T` - **Description**: Invokes the passed in closure with a checked continuation for the current task. #### `struct CheckedContinuation` ##### Function: `withCheckedThrowingContinuation` - **Signature**: `func withCheckedThrowingContinuation(isolation: isolated (any Actor)?, function: String, (CheckedContinuation) -> Void) async throws -> sending T` - **Description**: Invokes the passed in closure with a checked continuation for the current task. #### `struct UnsafeContinuation` ##### Description A mechanism to interface between synchronous and asynchronous code, without correctness checking. ##### Function: `withUnsafeContinuation` - **Signature**: `func withUnsafeContinuation(isolation: isolated (any Actor)?, (UnsafeContinuation) -> Void) async -> sending T` - **Description**: Invokes the passed in closure with a unsafe continuation for the current task. #### `struct UnsafeContinuation` ##### Function: `withUnsafeThrowingContinuation` - **Signature**: `func withUnsafeThrowingContinuation(isolation: isolated (any Actor)?, (UnsafeContinuation) -> Void) async throws -> sending T` - **Description**: Invokes the passed in closure with a unsafe continuation for the current task. ``` -------------------------------- ### UnsafeContinuation Instance Methods Source: https://developer.apple.com/documentation/swift/unsafecontinuation Details the methods available on an UnsafeContinuation instance for resuming the associated asynchronous task. ```APIDOC ## Instance Methods ### `resume()` ```swift func resume() ``` Resume the task that’s awaiting the continuation by returning. ### `resume(returning:)` (1) ```swift func resume(returning: sending T) ``` Resume the task that’s awaiting the continuation by returning the given value. ### `resume(returning:)` (2) ```swift func resume(returning: sending T) ``` Resume the task that’s awaiting the continuation by returning the given value. ### `resume(throwing:)` ```swift func resume(throwing: consuming E) ``` Resume the task that’s awaiting the continuation by throwing the given error. ### `resume(with:)` (1) ```swift func resume(with: sending Result) ``` Resume the task that’s awaiting the continuation by returning or throwing the given result value. ### `resume(with:)` (2) ```swift func resume(with: sending Result) ``` Resume the task that’s awaiting the continuation by returning or throwing the given result value. ``` -------------------------------- ### AsyncFilterSequence.Iterator Conformance Source: https://developer.apple.com/documentation/swift/sendablemetatype Details the conformance requirements for the Iterator of AsyncFilterSequence. ```APIDOC ## AsyncFilterSequence.Iterator ### Description Conforms when `Base` conforms to `AsyncSequence`, `Base.AsyncIterator` conforms to `Sendable`, and `Base.Element` conforms to `Sendable`. ### Conformance Requirements - **Base** (Type) - Conforms to `AsyncSequence` - **Base.AsyncIterator** (Type) - Conforms to `Sendable` - **Base.Element** (Type) - Conforms to `Sendable` ```