<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Contacts",
  "identifier" : "/documentation/Contacts/CNContainer",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Contacts"
    ],
    "preciseIdentifier" : "c:objc(cs)CNContainer"
  },
  "title" : "CNContainer"
}
-->

# CNContainer

An immutable object that represents a collection of contacts.

```
class CNContainer
```

## Overview

A contact can be in only one container. CardDAV accounts usually have only one container whereas Exchange accounts may have multiple containers, where each container represents an Exchange folder.

`CNContainer` objects are thread-safe, and you may access their properties from any thread of your app.

## Topics

### Getting the Container Information

[`name`](/documentation/Contacts/CNContainer/name)

The name of the container.

[`identifier`](/documentation/Contacts/CNContainer/identifier)

The unique identifier for a contacts container on the device.

[`type`](/documentation/Contacts/CNContainer/type)

The type of the container.

[`CNContainerType`](/documentation/Contacts/CNContainerType)

The container may be local on the device or associated with a server account that has contacts.

### Generating Search Predicates for Containers

These are the predicates to match containers contacts. You can only use these predicates with `CNContainer`.

[`+  predicateForContainerOfContactWithIdentifier:`](/documentation/Contacts/CNContainer/predicateForContainerOfContact(withIdentifier:))

Returns a predicate to find the container of the specified contact.

[`+  predicateForContainersWithIdentifiers:`](/documentation/Contacts/CNContainer/predicateForContainers(withIdentifiers:))

Returns a predicate to find the containers with the specified identifiers.

[`+  predicateForContainerOfGroupWithIdentifier:`](/documentation/Contacts/CNContainer/predicateForContainerOfGroup(withIdentifier:))

Returns a predicate to find the container of the specified group.

### Getting Container-Related Keys

[`CNContainerIdentifierKey`](/documentation/Contacts/CNContainerIdentifierKey)

The identifier key of the container.

[`CNContainerNameKey`](/documentation/Contacts/CNContainerNameKey)

The name of the container.

[`CNContainerTypeKey`](/documentation/Contacts/CNContainerTypeKey)

The type of the container.

## Relationships

### Conforms To

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

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

[`NSCoding`](/documentation/Foundation/NSCoding)

[`NSSecureCoding`](/documentation/Foundation/NSSecureCoding)

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

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`NSCopying`](/documentation/Foundation/NSCopying)

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

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

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

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)