Using Concurrency in old version of OS

I have to use a protocol.

public protocol WKNavigationDelegate : NSObjectProtocol {

@available(iOS 8.0, *)
optional func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction) async -> WKNavigationActionPolicy

I have some questions.

  1. Since async is only allowed after iOS 15, why this API says its availbility to be iOS 8.0?
  2. I want to use this method in iOS 14 and 15, so I have to use the sync version of this function as well. How can I use it together? So code will run the sync version on iOS 14 and run the async version on iOS 15?

Xcode told me I could not do that

Method 'webView(:decidePolicyFor:decisionHandler:)' with Objective-C selector 'webView:decidePolicyForNavigationAction:decisionHandler:' conflicts with method 'webView(:decidePolicyFor:)' with the same Objective-C selector

Looks like a bug. Backwards deployment of concurrency is currently neither confirmed nor denied. There are a bunch of other threads about that.

1 Like
Terms of Service

Privacy Policy

Cookie Policy