DataStreamTask
public struct DataStreamTask : Sendable
Undocumented
-
Undocumented
Declaration
Swift
public typealias Stream<Success, Failure> = StreamOf<DataStreamRequest.Stream<Success, Failure>> where Failure : Error
-
Creates a
Stream
ofData
values from the underlyingDataStreamRequest
.Declaration
Parameters
shouldAutomaticallyCancel
Bool
indicating whether the underlyingDataStreamRequest
should be canceled which observation of the stream stops.true
by default.bufferingPolicy
BufferingPolicy
that determines the stream’s buffering behavior..unbounded
by default.Return Value
The
Stream
. -
Creates a
Stream
ofUTF-8
String
s from the underlyingDataStreamRequest
.Declaration
Parameters
shouldAutomaticallyCancel
Bool
indicating whether the underlyingDataStreamRequest
should be canceled which observation of the stream stops.true
by default.bufferingPolicy
BufferingPolicy
that determines the stream’s buffering behavior..unbounded
by default.Return Value
-
Creates a
Stream
ofDecodable
values from the underlyingDataStreamRequest
.Declaration
Parameters
type
Decodable
type to be serialized from stream payloads.shouldAutomaticallyCancel
Bool
indicating whether the underlyingDataStreamRequest
should be canceled which observation of the stream stops.true
by default.bufferingPolicy
BufferingPolicy
that determines the stream’s buffering behavior..unbounded
by default.Return Value
The
Stream
. -
Creates a
Stream
of values using the providedDataStreamSerializer
from the underlyingDataStreamRequest
.Declaration
Swift
public func streamingResponses<Serializer: DataStreamSerializer>(serializedUsing serializer: Serializer, automaticallyCancelling shouldAutomaticallyCancel: Bool = true, bufferingPolicy: Stream<Serializer.SerializedObject, AFError>.BufferingPolicy = .unbounded) -> Stream<Serializer.SerializedObject, AFError>
Parameters
serializer
DataStreamSerializer
to use to serialize incomingData
.shouldAutomaticallyCancel
Bool
indicating whether the underlyingDataStreamRequest
should be canceled which observation of the stream stops.true
by default.bufferingPolicy
BufferingPolicy
that determines the stream’s buffering behavior..unbounded
by default.Return Value
The
Stream
. -
Cancel the underlying
DataStreamRequest
.Declaration
Swift
public func cancel()
-
Resume the underlying
DataStreamRequest
.Declaration
Swift
public func resume()
-
Suspend the underlying
DataStreamRequest
.Declaration
Swift
public func suspend()