Skip to content

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

expires

The cookie’s expiration date. Defaults to nil.

maxAge

The maximum cookie age in seconds. Defaults to nil.

domain

The affected domain at which the cookie is active. Defaults to nil.

path

The path at which the cookie is active. Defaults to "/".

isSecure

Limits the cookie to secure connections. If sameSite is none, this flag will be overridden with true. Defaults to false.

isHTTPOnly

Does not expose the cookie over non-HTTP channels. Defaults to false.

sameSite

See HTTPSameSitePolicy. Defaults to lax.

Discussion

let cookie = HTTPCookieValue(string: "123")