---
title: "subresource(for:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/webdatasource/subresource(for:)"
---

# subresource(for:)

Returns a subresource for the given URL.

## Declaration

```swift
func subresource(for URL: URL!) -> WebResource!
```

## Parameters

- `URL`: The subresource’s URL.

## Return Value

Return Value The subresource for URL or nil if the data source hasn’t finished downloading the subresource.

## See Also

### Accessing subresources

- [mainResource](webkit/webdatasource/mainresource.md)
- [addSubresource(_:)](webkit/webdatasource/addsubresource(_:).md)
- [subresources](webkit/webdatasource/subresources.md)
