<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: -",
    "macOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/URLSchemeHandler/reply(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "s:6WebKit16URLSchemeHandlerP5reply3for12TaskSequenceQz10Foundation10URLRequestV_tF"
  },
  "title" : "reply(for:)"
}
-->

# reply(for:)

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

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

## Discussion

Upon receiving the request, determine the size of the resource and add a [`URLSchemeTaskResult.response(_:)`](/documentation/WebKit/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(_:)`](/documentation/WebKit/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.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)