<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "HealthKit",
  "identifier" : "/documentation/HealthKit/HKMetadataKeySexualActivityProtectionUsed",
  "metadataVersion" : "0.1.0",
  "role" : "Global Variable",
  "symbol" : {
    "kind" : "Global Variable",
    "modules" : [
      "HealthKit"
    ],
    "preciseIdentifier" : "c:@HKMetadataKeySexualActivityProtectionUsed"
  },
  "title" : "HKMetadataKeySexualActivityProtectionUsed"
}
-->

# HKMetadataKeySexualActivityProtectionUsed

A key that indicates whether protection was used during sexual activity. This metadata key can be used with [`sexualActivity`](/documentation/HealthKit/HKCategoryTypeIdentifier/sexualActivity) category samples.

```
let HKMetadataKeySexualActivityProtectionUsed: String
```

## Discussion

Set this key’s value to <doc://com.apple.documentation/documentation/Swift/true> if protection was used during sexual activity; otherwise, set it to <doc://com.apple.documentation/documentation/Swift/false>.

---

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)