<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/HTTPCookiePropertyKey",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:@T@NSHTTPCookiePropertyKey"
  },
  "title" : "HTTPCookiePropertyKey"
}
-->

# HTTPCookiePropertyKey

Constants that define the supported keys in a cookie attributes dictionary.

```
struct HTTPCookiePropertyKey
```

## Topics

### Cookie property keys

[`comment`](/documentation/Foundation/HTTPCookiePropertyKey/comment)

An `NSString` object containing the comment for the cookie.

[`commentURL`](/documentation/Foundation/HTTPCookiePropertyKey/commentURL)

An `NSURL` object or `NSString` object containing the comment URL for the cookie.

[`discard`](/documentation/Foundation/HTTPCookiePropertyKey/discard)

An `NSString` object stating whether the cookie should be discarded at the end of the session.

[`domain`](/documentation/Foundation/HTTPCookiePropertyKey/domain)

An `NSString` object containing the domain for the cookie.

[`expires`](/documentation/Foundation/HTTPCookiePropertyKey/expires)

An `NSDate` object or `NSString` object specifying the expiration date for the cookie.

[`maximumAge`](/documentation/Foundation/HTTPCookiePropertyKey/maximumAge)

An `NSString` object containing an integer value stating how long in seconds the cookie should be kept, at most.

[`name`](/documentation/Foundation/HTTPCookiePropertyKey/name)

An `NSString` object containing the name of the cookie (required).

[`originURL`](/documentation/Foundation/HTTPCookiePropertyKey/originURL)

An NSURL or `NSString` object containing the URL that set this cookie.

[`path`](/documentation/Foundation/HTTPCookiePropertyKey/path)

An `NSString` object containing the path for the cookie.

[`port`](/documentation/Foundation/HTTPCookiePropertyKey/port)

An `NSString` object containing comma-separated integer values specifying the ports for the cookie.

[`sameSitePolicy`](/documentation/Foundation/HTTPCookiePropertyKey/sameSitePolicy)

A string indicating the same-site policy for the cookie.

[`secure`](/documentation/Foundation/HTTPCookiePropertyKey/secure)

An `NSString` object indicating that the cookie should be transmitted only over secure channels.

[`value`](/documentation/Foundation/HTTPCookiePropertyKey/value)

An `NSString` object containing the value of the cookie.

[`version`](/documentation/Foundation/HTTPCookiePropertyKey/version)

An `NSString` object that specifies the version of the cookie.

### Creating custom cookie property keys

[`init(_:)`](/documentation/Foundation/HTTPCookiePropertyKey/init(_:))

Creates an HTTP cookie property key using the given string.

[`init(rawValue:)`](/documentation/Foundation/HTTPCookiePropertyKey/init(rawValue:))

Creates an HTTP cookie property key using the given string.

### Type Properties

[`setByJavaScript`](/documentation/Foundation/HTTPCookiePropertyKey/setByJavaScript)

An NSString object indicating that the cookie is set via JavaScript.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)