---
title: "AECoerceDesc(_:_:_:)"
framework: coreservices
role: symbol
role_heading: Function
path: coreservices/1446519-aecoercedesc
---

# AECoerceDesc(_:_:_:)

Coerces the data in a descriptor to another descriptor type and creates a descriptor containing the newly coerced data.

## Declaration

```swift
func AECoerceDesc(_ theAEDesc: UnsafePointer<AEDesc>!, _ toType: DescType, _ result: UnsafeMutablePointer<AEDesc>!) -> OSErr
```

## Parameters

- `theAEDesc`: A pointer to the descriptor containing the data to coerce. See doc://com.apple.documentation/documentation/coreservices/aedesc.
- `toType`: The desired descriptor type of the resulting descriptor. For a list of AppleScript’s predefined descriptor types, see doc://com.apple.documentation/documentation/coreservices/apple_events/1542788-descriptor_type_constants. See doc://com.apple.documentation/documentation/coreservices/desctype.
- `result`: A pointer to a descriptor. On successful return, a descriptor containing the coerced data and matching the descriptor type specified in toType. On error, a null descriptor. If the function returns successfully, your application should call the doc://com.apple.documentation/documentation/coreservices/1444208-aedisposedesc function to dispose of the resulting descriptor after it has finished using it.

## Return Value

Return Value A result code. See Result Codes. If AECoerceDesc returns a nonzero result code, it returns a null descriptor record (a descriptor record of type typeNull, which does not contain any data) unless the Apple Event Manager is not available because of limited memory.

## Discussion

Discussion See the Version Notes section for the AECoercePtr(_:_:_:_:_:) function for information on when to use descriptor-based versus pointer-based coercion handlers starting in OS X version 10.2. Thread safe starting in OS X v10.2.

## See Also

### Coercing Descriptor Types

- [AECoercePtr(_:_:_:_:_:)](coreservices/1441846-aecoerceptr.md)
