---
title: "setProperty(_:forKey:in:)"
framework: foundation
role: symbol
role_heading: Type Method
path: "foundation/urlprotocol/setproperty(_:forkey:in:)"
---

# setProperty(_:forKey:in:)

Sets the property associated with the specified key in the specified request.

## Declaration

```swift
class func setProperty(_ value: Any, forKey key: String, in request: NSMutableURLRequest)
```

## Parameters

- `value`: The value to set for the specified property.
- `key`: The key for the specified property.
- `request`: The request for which to create the property.

## Discussion

Discussion Use this method to provide an interface for protocol implementors to customize protocol-specific information associated with URLRequest objects.

## See Also

### Getting and setting request properties

- [property(forKey:in:)](foundation/urlprotocol/property(forkey:in:).md)
- [removeProperty(forKey:in:)](foundation/urlprotocol/removeproperty(forkey:in:).md)
