---
title: "setProperty(_:forKey:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/stream/setproperty(_:forkey:)"
---

# setProperty(_:forKey:)

Attempts to set the value of a given property of the receiver and returns a Boolean value that indicates whether the value is accepted by the receiver.

## Declaration

```swift
func setProperty(_ property: Any?, forKey key: Stream.PropertyKey) -> Bool
```

## Parameters

- `property`: The value for key.
- `key`: The key for one of the receiver’s properties. See Constants for a description of the available property-key constants and expected values.

## Return Value

Return Value true if the value is accepted by the receiver, otherwise false.

## See Also

### Configuring Streams

- [property(forKey:)](foundation/stream/property(forkey:).md)
- [delegate](foundation/stream/delegate.md)
