---
title: "data(with:)"
framework: contacts
role: symbol
role_heading: Type Method
path: "contacts/cncontactvcardserialization/data(with:)"
---

# data(with:)

Returns the vCard representation of the specified contacts.

## Declaration

```swift
class func data(with contacts: [CNContact]) throws -> Data
```

## Parameters

- `contacts`: An array of contacts.

## Return Value

Return Value An NSData object with the vCard representation of the contact. Discussion note: In Swift, this method returns a nonoptional result and is marked with the throws keyword to indicate that it throws an error in cases of failure. You call this method in a try expression and handle any errors in the catch clauses of a do statement, as described in Error Handling in The Swift Programming Language and About Imported Cocoa Error Parameters.
