ResponseCookies

@propertyWrapper
public struct ResponseCookies
extension ResponseCookies: Decodable

A property wrapper that provides a convenient way to handle HTTP cookies in a response.

Example usage:

@ResponseCookies var cookies: [HTTPCookie]

This property wrapper can be used to manage HTTP cookies in a response.

  • The wrapped value representing an array of HTTPCookie objects.

    This property holds the array of HTTPCookie objects that are managed by this property wrapper.

    Declaration

    Swift

    public var wrappedValue: [HTTPCookie]
  • Initializes a new instance of ResponseCookies with an optional array of HTTPCookie objects.

    Example usage:

    @ResponseCookies var cookies: [HTTPCookie] = [cookie1, cookie2]
    

    Declaration

    Swift

    public init(wrappedValue: [HTTPCookie] = [])

    Parameters

    wrappedValue

    An array of HTTPCookie objects. Defaults to an empty array.

  • Initializes a new instance of ResponseCookies by decoding from the given decoder.

    This initializer should only be used with a ResponseDecoding decoder. If the decoder is not a ResponseDecoding instance, a runtime failure will occur.

    Throws

    APIError.invalidResponse if the response is invalid.

    Declaration

    Swift

    public init(from decoder: Decoder) throws

    Parameters

    decoder

    The decoder to read data from.