---
title: "setObject(_:forProperty:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsspeechsynthesizer/setobject(_:forproperty:)"
---

# setObject(_:forProperty:)

Specifies the value of a receiver’s property.

## Declaration

```swift
func setObject(_ object: Any?, forProperty property: NSSpeechSynthesizer.SpeechPropertyKey) throws
```

## Parameters

- `object`: The property’s new value. The supported properties are listed in NSSpeechStatusProperty Dictionary Keys.
- `property`: The property to set.

## Discussion

Discussion note: In Swift, this method returns Void and is marked with the throws keyword to indicate that it throws an error in cases of failure. You call this method in a try expression and handle any errors in the catch clauses of a do statement, as described in Error Handling in The Swift Programming Language and About Imported Cocoa Error Parameters.

## See Also

### Configuring Speech Attributes

- [addSpeechDictionary(_:)](appkit/nsspeechsynthesizer/addspeechdictionary(_:).md)
- [NSSpeechSynthesizer.DictionaryKey](appkit/nsspeechsynthesizer/dictionarykey.md)
- [object(forProperty:)](appkit/nsspeechsynthesizer/object(forproperty:).md)
- [NSSpeechSynthesizer.SpeechPropertyKey](appkit/nsspeechsynthesizer/speechpropertykey.md)
- [NSSpeechSynthesizer.SpeechPropertyKey.CommandDelimiterKey](appkit/nsspeechsynthesizer/speechpropertykey/commanddelimiterkey.md)
- [NSSpeechSynthesizer.SpeechPropertyKey.ErrorKey](appkit/nsspeechsynthesizer/speechpropertykey/errorkey.md)
- [NSSpeechSynthesizer.SpeechPropertyKey.Mode](appkit/nsspeechsynthesizer/speechpropertykey/mode.md)
- [NSSpeechSynthesizer.SpeechPropertyKey.PhonemeInfoKey](appkit/nsspeechsynthesizer/speechpropertykey/phonemeinfokey.md)
- [NSSpeechSynthesizer.SpeechPropertyKey.StatusKey](appkit/nsspeechsynthesizer/speechpropertykey/statuskey.md)
- [NSSpeechSynthesizer.SpeechPropertyKey.SynthesizerInfoKey](appkit/nsspeechsynthesizer/speechpropertykey/synthesizerinfokey.md)
- [NSSpeechSynthesizer.VoiceGender](appkit/nsspeechsynthesizer/voicegender.md)
