SequenceAsyncSequence
public struct SequenceAsyncSequence<P> : AsyncSequence where P : Sequence
An async version of Sequence
. Generally used to turn any Sequence
into
it’s async counterpart.
let sequence = [0, 1, 2, 3].async
for await value in sequence {
print(value)
}
// Prints:
// 1
// 2
// 3
-
The kind of elements streamed.
Declaration
Swift
public typealias Element = P.Element
-
Creates an async sequence that combines the two async sequence.
Declaration
Swift
public init(_ sequence: P)
Parameters
p
A sequence.
-
Creates an async iterator that emits elements of this async sequence.
Declaration
Swift
public func makeAsyncIterator() -> SequenceAsyncSequenceIterator<P>
Return Value
An instance that conforms to
AsyncIteratorProtocol
.