# navigationDelegates

Your navigation delegates, in order. While the hook is off, none of them gets a callback.

```swift
var navigationDelegates: [WKNavigationDelegate] { get set }
```

## Discussion

WebKit reads which callbacks a delegate implements when it is assigned, so a delegate must implement what it handles by the time you add it.

Each callback reaches the delegates by one of these rules:

- A decision, the action or the response policy, goes to the first delegate that implements it, instead of the core. Either action policy variant, with or without `preferences`, counts, and that delegate’s own variant is called.
- The authentication challenge goes to each delegate that implements it, in order, until one answers other than `.performDefaultHandling`; when none does, WebKit’s default handling, or `.rejectProtectionSpace` once the site has rejected a credential, so its 401 page loads. Each must call its completion handler exactly once, and the next delegate gets the challenge only after that.
- Every other callback the core implements reaches the core, then each delegate that implements it.
- `didStartProvisionalNavigation` and `didReceiveServerRedirectForProvisionalNavigation` reach each delegate that implements them.
- Any other callback goes only to the first delegate that implements it.

Taking a decision switches off what the core decides from the app’s props or their defaults, the default navigation rules’ security checks included, and a warning names the callback and what stops applying. A delegate that takes the action policy decides navigations instead of the navigation rules, which still decide new windows unless a UI delegate takes `createWebViewWith`. A new window the rules allow loads in place, and that load reaches the delegate that takes the action policy.

A decision more than one delegate implements still goes only to the first, and a warning names it. Each warning comes once per WebView, when the delegate is added.

While `onDownload` is set, a delegate whose `didBecome` sets `download.delegate` takes the download, and `onDownload` gets nothing for it.
