<!--
{
  "availability" : [
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSAppleEventDescriptor/init(descriptorType:bytes:length:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSAppleEventDescriptor(im)initWithDescriptorType:bytes:length:"
  },
  "title" : "init(descriptorType:bytes:length:)"
}
-->

# init(descriptorType:bytes:length:)

Initializes a newly allocated instance as a descriptor with the specified descriptor type and data (from an arbitrary sequence of bytes and a length count).

```
convenience init?(descriptorType: DescType, bytes: UnsafeRawPointer?, length byteCount: Int)
```

## Parameters

`descriptorType`

The descriptor type to be set in the returned descriptor.

`bytes`

The data, as a sequence of bytes, to be set in the returned descriptor.

`byteCount`

The length, in bytes, of the data to be set in the returned descriptor.

## Return Value

An instance of `NSAppleEventDescriptor` with the specified type and data. Returns `nil` if an error occurs.

---

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)