---
title: "coerce(toDescriptorType:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsappleeventdescriptor/coerce(todescriptortype:)"
---

# coerce(toDescriptorType:)

Returns a descriptor obtained by coercing the receiver to the specified type.

## Declaration

```swift
func coerce(toDescriptorType descriptorType: DescType) -> NSAppleEventDescriptor?
```

## Parameters

- `descriptorType`: The descriptor type to coerce the receiver to.

## Return Value

Return Value A descriptor of the specified type, or nil if an error occurs.

## See Also

### Getting Information About a Descriptor

- [aeDesc](foundation/nsappleeventdescriptor/aedesc.md)
- [booleanValue](foundation/nsappleeventdescriptor/booleanvalue.md)
- [data](foundation/nsappleeventdescriptor/data.md)
- [descriptorType](foundation/nsappleeventdescriptor/descriptortype.md)
- [enumCodeValue](foundation/nsappleeventdescriptor/enumcodevalue.md)
- [int32Value](foundation/nsappleeventdescriptor/int32value.md)
- [numberOfItems](foundation/nsappleeventdescriptor/numberofitems.md)
- [stringValue](foundation/nsappleeventdescriptor/stringvalue.md)
- [typeCodeValue](foundation/nsappleeventdescriptor/typecodevalue.md)
