---
title: "appending(_:)"
framework: diskimagekit
role: symbol
role_heading: Instance Method
path: "diskimagekit/diskimage/appending(_:)-3pfqg"
---

# appending(_:)

Appends a new layer to this disk image, creating or extending a stack

## Declaration

```swift
consuming func appending(_ configuration: any DiskImage.CreationConfiguration & DiskImage.StackableLayer) throws -> any StackedImage
```

## Parameters

- `configuration`: The configuration to use to create the new layer.

## Return Value

Return Value A StackedImage containing all layers.

## Discussion

Discussion note: The framework allows only one cache layer per stacked disk image. This method creates a stacked disk image by creating and appending a new layer to either a base image or an existing stacked image. When the image is already a stacked image, the framework adds the new layer on top of the existing stack. note: IncompatibleStackingError if the appended layer isn’t compatible with the stack. InvalidBlockCountError if the block count is zero or negative. POSIXError if the new layer cannot be created.
