---
title: "init(buffer:initializedCount:)"
framework: swift
role: symbol
role_heading: Initializer
path: "swift/outputspan/init(buffer:initializedcount:)-vie3"
---

# init(buffer:initializedCount:)

Unsafely create an OutputSpan over partly-initialized memory.

## Declaration

```swift
init(buffer: borrowing Slice<UnsafeMutableBufferPointer<Element>>, initializedCount: Int)
```

## Parameters

- `buffer`: A slice of an UnsafeMutableBufferPointer to be initialized
- `initializedCount`: The number of initialized elements at the beginning of buffer.

## Discussion

Discussion The memory in buffer must remain valid throughout the lifetime of the newly-created OutputSpan. Its prefix must contain initializedCount initialized instances, followed by uninitialized memory. The default value of initializedCount is 0, representing the common case of a completely uninitialized buffer.
