<!--
{
  "availability" : [
    "iOS: 7.0.0 - 27.0.0",
    "iPadOS: 7.0.0 - 27.0.0",
    "macCatalyst: 13.1.0 - 27.0.0",
    "macOS: 10.10.0 - 27.0.0",
    "tvOS: 10.0.0 - 27.0.0",
    "visionOS: 1.0.0 - 27.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "MultipeerConnectivity",
  "identifier" : "/documentation/MultipeerConnectivity/MCEncryptionPreference",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "Multipeer Connectivity"
    ],
    "preciseIdentifier" : "c:@E@MCEncryptionPreference"
  },
  "title" : "MCEncryptionPreference"
}
-->

# MCEncryptionPreference

Indicates whether a session should use encryption when communicating with nearby peers.

```
enum MCEncryptionPreference
```

## Topics

### Constants

[`MCEncryptionOptional`](/documentation/MultipeerConnectivity/MCEncryptionPreference/optional)

The session prefers to use encryption, but accepts unencrypted connections. A connection uses encryption when all the peers choose either [`MCEncryptionPreference.optional`](/documentation/MultipeerConnectivity/MCEncryptionPreference/optional) or [`MCEncryptionPreference.required`](/documentation/MultipeerConnectivity/MCEncryptionPreference/required). If some peers choose [`MCEncryptionPreference.none`](/documentation/MultipeerConnectivity/MCEncryptionPreference/none), then the session will not be encrypted. For this reason, if some peers running your app can be configured without encryption, you should always assume that the session is unencrypted.

[`MCEncryptionRequired`](/documentation/MultipeerConnectivity/MCEncryptionPreference/required)

The session requires encryption.

[`MCEncryptionNone`](/documentation/MultipeerConnectivity/MCEncryptionPreference/none)

The session should not be encrypted.

## Relationships

### Conforms To

[`Equatable`](/documentation/Swift/Equatable)

[`Hashable`](/documentation/Swift/Hashable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`BitwiseCopyable`](/documentation/Swift/BitwiseCopyable)

[`Sendable`](/documentation/Swift/Sendable)

[`RawRepresentable`](/documentation/Swift/RawRepresentable)

---

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)