---
title: "init(descriptorType:bytes:length:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/nsappleeventdescriptor/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).

## Declaration

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

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

## See Also

### Creating and Initializing Descriptors

- [appleEvent(withEventClass:eventID:targetDescriptor:returnID:transactionID:)](foundation/nsappleeventdescriptor/appleevent(witheventclass:eventid:targetdescriptor:returnid:transactionid:).md)
- [init(boolean:)](foundation/nsappleeventdescriptor/init(boolean:).md)
- [init(enumCode:)](foundation/nsappleeventdescriptor/init(enumcode:).md)
- [init(int32:)](foundation/nsappleeventdescriptor/init(int32:).md)
- [init(string:)](foundation/nsappleeventdescriptor/init(string:).md)
- [init(typeCode:)](foundation/nsappleeventdescriptor/init(typecode:).md)
- [list()](foundation/nsappleeventdescriptor/list().md)
- [null()](foundation/nsappleeventdescriptor/null().md)
- [record()](foundation/nsappleeventdescriptor/record().md)
- [init(listDescriptor:)](foundation/nsappleeventdescriptor/init(listdescriptor:).md)
- [init(recordDescriptor:)](foundation/nsappleeventdescriptor/init(recorddescriptor:).md)
- [init(aeDescNoCopy:)](foundation/nsappleeventdescriptor/init(aedescnocopy:)-5cioa.md)
- [init(descriptorType:data:)](foundation/nsappleeventdescriptor/init(descriptortype:data:).md)
- [init(eventClass:eventID:targetDescriptor:returnID:transactionID:)](foundation/nsappleeventdescriptor/init(eventclass:eventid:targetdescriptor:returnid:transactionid:).md)
