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
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
RequestCookies
with an optional array ofHTTPCookie
objects.Example usage:
@RequestCookies var cookies: [HTTPCookie] = [cookie1, cookie2]
Declaration
Swift
public init(wrappedValue: [HTTPCookie] = [])
Parameters
wrappedValue
An array of
HTTPCookie
objects. Defaults to an empty array.
-
Encodes this value into the given encoder.
This method should never be called because
HTTPCookie
does 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) throws
Parameters
encoder
The encoder to write data to.