Type Aliases

The following type aliases are available globally.

  • Type for mock delay randomizer.

    Declaration

    Swift

    public typealias MockDelayType = (min: TimeInterval, max: TimeInterval)

    Parameters

    min

    The lower bound of interval.

    max

    The upper bound of interval.

  • Progress callback type

    Declaration

    Swift

    public typealias ProgressCallbackType = (Int, Int, Float) -> Void

    Parameters

    bytesSent/bytesDownloaded

    The total size of bytes sent/downloaded to/from server.

    totalBytes

    The total size of upload/download data.

    progress

    Download/Upload progress

  • Hook type for beforeAllRequestsCallback queue property

    Declaration

    Swift

    public typealias BeforeQueueStartCallbackType = () -> Void
  • Hook type for afterAllRequestsCallback queue property

    Declaration

    Swift

    public typealias AfterAllRequestsCallbackType = (_ hasError: Bool) -> Void

    Parameters

    hasError

    Passes a Boolean value which indicates if any of the request in queue has completed with error.

  • Hook type for beforeEachRequestCallback queue property

    Declaration

    Swift

    public typealias BeforeEachRequestCallbackType = (_ request: Request) -> Void

    Parameters

    request

    The actual Request instance.

  • Hook type for afterEachRequestCallback queue property

    Declaration

    Swift

    public typealias AfterEachRequestCallbackType = (
        _ request: Request,
        _ data: Data?,
        _ response: URLResponse?,
        _ error: Error?) -> Void

    Parameters

    request

    The actual Request instance.

    data

    The response data

    response

    The URLResponse

    error

    The network error (if any)

  • Custom type for success data task.

    Declaration

    Swift

    public typealias SuccessCallback<T> = (T) -> Void
  • Custom type for download success data task.

    Declaration

    Swift

    public typealias DownloadSuccessCallback = () -> Void
  • Custom type for failure data task.

    Declaration

    Swift

    public typealias FailureCallback = (_ error: TNError, _ data: Data?) -> Void
  • The Image type depending on platform: UIImage for iOS or NSImage for macOS.

    Declaration

    Swift

    public typealias ImageType = NSImage
  • The Image type depending on platform: UIImage for iOS or NSImage for macOS.

  • Callback type for image preprocess used in UIImageView|NSImage|WKInterfaceImage and Image (SwiftUI) helpers

    Declaration

    Swift

    public typealias ImagePreprocessType = (ImageType) -> (ImageType)

    Parameters

    image

    The downloaded image.

    Return Value

    The new transformed image.

  • Callback type for image downloaded event.

    Declaration

    Swift

    public typealias ImageOnFinishCallbackType = (ImageType?, TNError?) -> Void

    Parameters

    image

    The downloaded image.

    error

    A TNError object if it fails to download.

    Return Value

    The new transformed image.