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

# property(forKey:in:)

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

## Declaration

```swift
class func property(forKey key: String, in request: URLRequest) -> Any?
```

## Parameters

- `key`: The key of the desired property.
- `request`: The request whose properties are to be queried.

## Return Value

Return Value The property associated with key, or nil if no property has been stored for key.

## Discussion

Discussion Use this method to access protocol-specific information associated with URLRequest objects.

## See Also

### Getting and setting request properties

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