<!--
{
  "availability" : [
    "macOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "DiskImageKit",
  "identifier" : "/documentation/DiskImageKit/DiskImage/appending(_:)-3pfqg",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "DiskImageKit"
    ],
    "preciseIdentifier" : "s:12DiskImageKit0aB0C9appendingyAA07StackedB0_pAC21CreationConfiguration_AC14StackableLayerpKF"
  },
  "title" : "appending(_:)"
}
-->

# appending(_:)

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

```
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

A [`StackedImage`](/documentation/DiskImageKit/StackedImage) containing all layers.

## 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.

> Throws: ``doc://com.apple.diskimagekit/documentation/DiskImageKit/IncompatibleStackingError`` if the appended layer isn’t compatible with the stack.
> ``doc://com.apple.diskimagekit/documentation/DiskImageKit/InvalidBlockCountError`` if the block count is zero or negative.
> `POSIXError` if the new layer cannot be created.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)