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
HTTPCookieobjects.This property holds the array of
HTTPCookieobjects that are managed by this property wrapper.Declaration
Swift
public var wrappedValue: [HTTPCookie] -
Initializes a new instance of
ResponseCookieswith an optional array ofHTTPCookieobjects.Example usage:
@ResponseCookies var cookies: [HTTPCookie] = [cookie1, cookie2]Declaration
Swift
public init(wrappedValue: [HTTPCookie] = [])Parameters
wrappedValueAn array of
HTTPCookieobjects. Defaults to an empty array. -
Initializes a new instance of
ResponseCookiesby decoding from the given decoder.This initializer should only be used with a
ResponseDecodingdecoder. If the decoder is not aResponseDecodinginstance, a runtime failure will occur.Throws
APIError.invalidResponseif the response is invalid.Declaration
Swift
public init(from decoder: Decoder) throwsParameters
decoderThe decoder to read data from.
View on GitHub