Q:

Swift: How to intercept network requests made in in-app browser?

I am currently using SafariViewController as my in-app browser. I am trying to automatically load AVPlayerViewController when the URL matches the regex /youtube\.com/ instead of actually loading the youtube page. 
Is this possible with SafariViewController? I looked in the documentation but I the delegate methods don't do anything related to this. I can also change the browser to a WKWebView or the other one, although that is not as favorable.

A:

The SFSafariViewController is designed to give you a way to present the typical Safari experience, with minimal customization (as can be seen in the sparseness of the customization functionality available to SFSafariViewControllerDelegate).  If you want to do more complex customization of the experience, you're more or less stuck with WKWebView.  This is described in the SFSafariViewController documentation:

Use the SFSafariViewController class if your app lets users view
  websites from anywhere on the Internet. Use the WKWebView class if
  your app customizes, interacts with, or controls the display of web
  content.

