<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.13.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WKURLSchemeTask/didFinish()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "c:objc(pl)WKURLSchemeTask(im)didFinish"
  },
  "title" : "didFinish()"
}
-->

# didFinish()

Signals the successful completion of the task.

```
func didFinish()
```

## Discussion

This method signals to WebKit that it has all of the resource’s data and the task is now complete. Call this method after sending a response and the resource data to WebKit using the [`didReceive(_:)`](/documentation/WebKit/WKURLSchemeTask/didReceive(_:)-2u23r) and [`didReceive(_:)`](/documentation/WebKit/WKURLSchemeTask/didReceive(_:)-8t5f8) methods.

This method raises an exception if you call it before the [`didReceive(_:)`](/documentation/WebKit/WKURLSchemeTask/didReceive(_:)-2u23r) method, or if the task is already complete. It also raises an exception if you call it after WebKit calls the [`webView(_:stop:)`](/documentation/WebKit/WKURLSchemeHandler/webView(_:stop:)) method of the corresponding handler object.

---

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)