title: Declare WKWebView delegates in a macOS 10.8+ compatible app
body: <p>Let me be more clear. I have an app which is macOS 10.8+ compatible, however I want to use <code>WKWebView</code> if the user is using macOS 10.10+, to give him/her a better experience. </p>
  
  <p>I created a <code>NSView</code>-based class which should automatically add a <code>WebView</code> if the user is using macOS 10.9 or below, and <code>WKWebView</code> if it's using 10.10 or superior. The problem comes when I need to declare <code>WKWebView</code> navigation and UI delegates.</p>
  
  <p>I can add the WebView delegate functions without any trouble:</p>
  
  <pre><code>-(WebView *)webView:(WebView *)sender createWebViewWithRequest:(NSURLRequest *)request;
  
  -(void)webView:(WebView *)webView decidePolicyForNavigationAction:(NSDictionary *)actionInformation 
         request:(NSURLRequest *)request frame:(WebFrame *)frame 
                              decisionListener:(id&lt;WebPolicyDecisionListener&gt;)listener;
  </code></pre>
  
  <p>However, I need to declare the functions below to able to control the WKWebView flow as well:</p>
  
  <pre><code>- (WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration 
     forNavigationAction:(WKNavigationAction *)navigationAction 
          windowFeatures:(WKWindowFeatures *)windowFeatures;
  
  - (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction 
  decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler;
  </code></pre>
  
  <p>However, both use, together, <code>WKWebView</code>, <code>WKWebViewConfiguration</code>, <code>WKNavigationAction</code>, <code>WKWindowFeatures</code> and <code>WKNavigationActionPolicy</code>, which were not available in macOS 10.9 and below.</p>
  
  <p>Based in my experience with <code>NSUserNotificationCenter</code>, I know that if I declare a function with those objects, it app will immediately crash on launch in macOS 10.8 and 10.9 because those classes aren't available. How can I avoid that?</p>