---
title: "init(url:readOnly:)"
framework: virtualization
role: symbol
role_heading: Initializer
path: "virtualization/vzdiskimagestoragedeviceattachment/init(url:readonly:)-9qeco"
---

# init(url:readOnly:)

Creates the attachment object from the specified disk image.

## Declaration

```swift
init(url: URL, readOnly: Bool) throws
```

## Parameters

- `url`: A URL that points to a local disk image in RAW format.
- `readOnly`: A Boolean that indicates whether to configure the disk image as read-only. Specify doc://com.apple.documentation/documentation/Swift/true to prevent the guest operating system from writing to the disk image, and doc://com.apple.documentation/documentation/Swift/false to allow writing.

## Return Value

Return Value In Swift the methods returns an attachment object; in Objective-C the methods returns an attachment object on success, or nil if an error occurred

## See Also

### Creating the attachment point

- [init(url:readOnly:cachingMode:synchronizationMode:)](virtualization/vzdiskimagestoragedeviceattachment/init(url:readonly:cachingmode:synchronizationmode:)-36gc5.md)
- [init(url:readOnly:cachingMode:synchronizationMode:)](virtualization/vzdiskimagestoragedeviceattachment/init(url:readonly:cachingmode:synchronizationmode:)-36gc5.md)
