<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 7.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Network",
  "identifier" : "/documentation/Network/NWParameters/setPrivacyContext(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Network"
    ],
    "preciseIdentifier" : "s:7Network12NWParametersC17setPrivacyContextyyAC0dE0CF"
  },
  "title" : "setPrivacyContext(_:)"
}
-->

# setPrivacyContext(_:)

Associates a privacy context with any connections or listeners that use the parameters.

```
final func setPrivacyContext(_ privacyContext: NWParameters.PrivacyContext)
```

## Discussion

The privacy context allows using separate caches for different sets of connections, as well as restricting how connection-specific information is logged and shared on the network.

---

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)