<!--
{
  "availability" : [
    "macOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "DiskImageKit",
  "identifier" : "/documentation/DiskImageKit/DiskImage/init(creating:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "DiskImageKit"
    ],
    "preciseIdentifier" : "s:12DiskImageKit0aB0C8creatingACx_tKcAC21CreationConfigurationRzlufc"
  },
  "title" : "init(creating:)"
}
-->

# init(creating:)

Creates a new, empty disk image.

```
convenience init(creating configuration: some DiskImage.CreationConfiguration) throws
```

## Parameters

`configuration`

A configuration object that specifies the parameters for the new disk image. If the URL points to an existing file, the framework overwrites it.

## Discussion

Use this initializer to create a new standalone disk image or a base image for a stacked disk image.
The `configuration` must not be a [`DiskImage.StackableLayer`](/documentation/DiskImageKit/DiskImage/StackableLayer); use [`appending(_:)`](/documentation/DiskImageKit/DiskImage/appending(_:)-3pfqg) instead.

The following example creates an ASIF disk image at a specific location, a block count, and block size you specify with an
[`ASIFCreationConfiguration`](/documentation/DiskImageKit/ASIFCreationConfiguration) configuration object.

```
let image = try DiskImage(creating: .asif(url: imageURL, blockCount: 1000000000, blockSize: .bytes512))
```

> Throws: ``doc://com.apple.diskimagekit/documentation/DiskImageKit/InvalidBlockCountError`` if the block count is zero or negative.
> `POSIXError` if the disk image cannot be created.

## See Also



---

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)