---
title: CNContainer
framework: contacts
role: symbol
role_heading: Class
path: contacts/cncontainer
---

# CNContainer

An immutable object that represents a collection of contacts.

## Declaration

```swift
class CNContainer
```

## Overview

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](contacts/cncontainer/name.md)
- [identifier](contacts/cncontainer/identifier.md)
- [type](contacts/cncontainer/type.md)
- [CNContainerType](contacts/cncontainertype.md)

### Generating Search Predicates for Containers

- [predicateForContainerOfContact(withIdentifier:)](contacts/cncontainer/predicateforcontainerofcontact(withidentifier:).md)
- [predicateForContainers(withIdentifiers:)](contacts/cncontainer/predicateforcontainers(withidentifiers:).md)
- [predicateForContainerOfGroup(withIdentifier:)](contacts/cncontainer/predicateforcontainerofgroup(withidentifier:).md)

### Getting Container-Related Keys

- [CNContainerIdentifierKey](contacts/cncontaineridentifierkey.md)
- [CNContainerNameKey](contacts/cncontainernamekey.md)
- [CNContainerTypeKey](contacts/cncontainertypekey.md)

### Initializers

- [init(coder:)](contacts/cncontainer/init(coder:).md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)

## See Also

### Groups and Containers

- [CNGroup](contacts/cngroup.md)
- [CNMutableGroup](contacts/cnmutablegroup.md)
