Initializer
init(string:expires:maxAge:domain:path:isSecure:isHTTPOnly:sameSite:)
Creates a new
HTTPCookieValue.init(string: String, expires: Date? = nil, maxAge: Int? = nil, domain: String? = nil, path: String? = "/", isSecure: Bool = false, isHTTPOnly: Bool = false, sameSite: HTTPCookies.SameSitePolicy? = .lax)
Parameters
expiresThe cookie’s expiration date. Defaults to
nil.maxAgeThe maximum cookie age in seconds. Defaults to
nil.domainThe affected domain at which the cookie is active. Defaults to
nil.pathThe path at which the cookie is active. Defaults to
"/".isSecureLimits the cookie to secure connections. If
sameSiteisnone, this flag will be overridden withtrue. Defaults tofalse.isHTTPOnlyDoes not expose the cookie over non-HTTP channels. Defaults to
false.sameSiteSee
HTTPSameSitePolicy. Defaults tolax.
Discussion
let cookie = HTTPCookieValue(string: "123")