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

# reply(for:)

Produces a sequence of intermixed responses and data to load a resource for a given request.

## Declaration

```swift
func reply(for request: URLRequest) -> Self.TaskSequence
```

## Discussion

Discussion Upon receiving the request, determine the size of the resource and add a URLSchemeTaskResult.response(_:) value to the async sequence. Providing a response mirrors the behavior that a web server performs when it receives a request. After you load some portion of the resource data, add a URLSchemeTaskResult.data(_:) value to the sequence. Multiple of these values may be added to the sequence to delivery data incrementally, or a single one with all of the data. If an error occurs at any point during the load process, a value of type Failure can be thrown to report it.
