Back to Alamofire

DataStreamTask

docs/docsets/Alamofire.docset/Contents/Resources/Documents/Structs/DataStreamTask.html

5.12.04.9 KB
Original Source

DataStreamTask

public struct DataStreamTask : Sendable

Undocumented

`

                Stream
                `

Undocumented

Declaration

Swift

public typealias Stream<Success, Failure> = StreamOf<DataStreamRequest.Stream<Success, Failure>> where Failure : Error

`

                streamingData(automaticallyCancelling:bufferingPolicy:)
                `

Creates a Stream of Data values from the underlying DataStreamRequest.

Declaration

Swift

public func streamingData(automaticallyCancelling shouldAutomaticallyCancel: Bool = true, bufferingPolicy: Stream<Data, Never>.BufferingPolicy = .unbounded) -> Stream<Data, Never>

Parameters

| shouldAutomaticallyCancel |

Bool indicating whether the underlying DataStreamRequest 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.

`

                streamingStrings(automaticallyCancelling:bufferingPolicy:)
                `

Creates a Stream of UTF-8 Strings from the underlying DataStreamRequest.

Declaration

Swift

public func streamingStrings(automaticallyCancelling shouldAutomaticallyCancel: Bool = true, bufferingPolicy: Stream<String, Never>.BufferingPolicy = .unbounded) -> Stream<String, Never>

Parameters

| shouldAutomaticallyCancel |

Bool indicating whether the underlying DataStreamRequest 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

`

                streamingDecodables(_:automaticallyCancelling:bufferingPolicy:)
                `

Creates a Stream of Decodable values from the underlying DataStreamRequest.

Declaration

Swift

public func streamingDecodables<T>(_ type: T.Type = T.self,
                                   automaticallyCancelling shouldAutomaticallyCancel: Bool = true,
                                   bufferingPolicy: Stream<T, AFError>.BufferingPolicy = .unbounded)
    -> Stream<T, AFError> where T: Decodable & Sendable

Parameters

| type |

Decodable type to be serialized from stream payloads.

| | shouldAutomaticallyCancel |

Bool indicating whether the underlying DataStreamRequest 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.

`

                streamingResponses(serializedUsing:automaticallyCancelling:bufferingPolicy:)
                `

Creates a Stream of values using the provided DataStreamSerializer from the underlying DataStreamRequest.

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 incoming Data.

| | shouldAutomaticallyCancel |

Bool indicating whether the underlying DataStreamRequest 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()
                `

Cancel the underlying DataStreamRequest.

Declaration

Swift

public func cancel()

`

                resume()
                `

Resume the underlying DataStreamRequest.

Declaration

Swift

public func resume()

`

                suspend()
                `

Suspend the underlying DataStreamRequest.

Declaration

Swift

public func suspend()