RequestCookies
@propertyWrapper
public struct RequestCookies
extension RequestCookies: Encodable
A property wrapper that provides a convenient way to handle HTTP cookies in a request.
Example usage:
@RequestCookies var cookies: [HTTPCookie]
This property wrapper can be used to manage HTTP cookies in a request.
-
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
RequestCookieswith an optional array ofHTTPCookieobjects.Example usage:
@RequestCookies var cookies: [HTTPCookie] = [cookie1, cookie2]Declaration
Swift
public init(wrappedValue: [HTTPCookie] = [])Parameters
wrappedValueAn array of
HTTPCookieobjects. Defaults to an empty array.
-
Encodes this value into the given encoder.
This method should never be called because
HTTPCookiedoes not conform toEncodable. If called, it will cause a runtime failure.Throws
A runtime error indicating that this method should not be called.Declaration
Swift
public func encode(to encoder: Encoder) throwsParameters
encoderThe encoder to write data to.
View on GitHub