• 2020-02-18
  • 2020-02-18

Which class is better? WKWebView or SFSafariViewController?

In general, The WKWebView class is better choice when you replace the UIWebView class. However, in some cases, the SFSafariViewController can be better choice. Better class is decided by the requirements Which class is better? You may want to consider following: An app want to do something when read the web page. An app want to know the URL of the web page. An app want to execute the JavaScript on the page. If your app fit to above, your app should use WKWebView. SFSafariViewController can’t do above. Is the requirements really needed? “My app want to do “Something” when read the page”. Is it really needed? For example, your app want to open the specified URL, or want to execute JavaScript to only close the view? It may be enough that by placing the close button on the navigation bar. In some cases, An app display the login page, and received the specified URL, an app close the view. In this case, especially with the OAuth2, you can set the redirect URL to the custom URL Scheme (Deep Link), UIApplicationDelegate can respond to it. You can use SFSafariViewController in this case. Is opening the browser really good UX? Your […]