---
title: "setDescriptor(_:forKeyword:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsappleeventdescriptor/setdescriptor(_:forkeyword:)"
---

# setDescriptor(_:forKeyword:)

Adds a descriptor, identified by a keyword, to the receiver.

## Declaration

```swift
func setDescriptor(_ descriptor: NSAppleEventDescriptor, forKeyword keyword: AEKeyword)
```

## Parameters

- `descriptor`: The descriptor to add to the receiver.
- `keyword`: A keyword (a four-character code) that identifies the descriptor to add. If a descriptor with that keyword already exists in the receiver, it is replaced.

## Discussion

Discussion The receiver must be an Apple event or Apple event record. Currently provides no indication if an error occurs.

## See Also

### Working With Record Descriptors

- [forKeyword(_:)](foundation/nsappleeventdescriptor/forkeyword(_:).md)
- [keywordForDescriptor(at:)](foundation/nsappleeventdescriptor/keywordfordescriptor(at:).md)
- [remove(withKeyword:)](foundation/nsappleeventdescriptor/remove(withkeyword:).md)
