---
title: "init(copying:)"
framework: cryptokit
role: symbol
role_heading: Initializer
path: "cryptokit/chachapoly/nonce/init(copying:)"
---

# init(copying:)

Creates a nonce from the given data.

## Declaration

```swift
init(copying bytes: RawSpan) throws
```

## Parameters

- `bytes`: The bytes that represent the nonce. The initializer throws an error if the data isn’t 12 bytes long.

## Discussion

Discussion Unless your use case calls for a nonce with a specific value, use the init() method to instead create a random nonce.
