---
title: "init(creating:)"
framework: diskimagekit
role: symbol
role_heading: Initializer
path: "diskimagekit/diskimage/init(creating:)"
---

# init(creating:)

Creates a new, empty disk image.

## Declaration

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

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; use appending(_:) instead. The following example creates an ASIF disk image at a specific location, a block count, and block size you specify with an ASIFCreationConfiguration configuration object. let image = try DiskImage(creating: .asif(url: imageURL, blockCount: 1000000000, blockSize: .bytes512)) note: InvalidBlockCountError if the block count is zero or negative. POSIXError if the disk image cannot be created.

## See Also

### Creating disk images

- [ASIFCreationConfiguration](diskimagekit/asifcreationconfiguration.md)
- [ASIFLayerCreationConfiguration](diskimagekit/asiflayercreationconfiguration.md)
- [DiskImage.CreationConfiguration](diskimagekit/diskimage/creationconfiguration.md)
- [RAWCreationConfiguration](diskimagekit/rawcreationconfiguration.md)
