---
title: "init(unsafeRetaining:)"
framework: avfaudio
role: symbol
role_heading: Initializer
path: "avfaudio/avreadonlyaudiopcmbuffer/init(unsaferetaining:)"
---

# init(unsafeRetaining:)

Creates a read-only buffer by retaining the existing PCM buffer without copying.

## Declaration

```swift
init(unsafeRetaining buffer: sending AVAudioPCMBuffer)
```

## Parameters

- `buffer`: The PCM buffer to retain (not copied).

## Discussion

Discussion warning: The caller must ensure the original buffer is not modified while this read-only buffer is in use. Violating this contract results in undefined behavior.

## See Also

### Creating a read-only buffer

- [init(copying:)](avfaudio/avreadonlyaudiopcmbuffer/init(copying:).md)
- [init(format:frameCapacity:initializingWith:)](avfaudio/avreadonlyaudiopcmbuffer/init(format:framecapacity:initializingwith:).md)
