Assuming the website you are loading uses User-Agent to change content/layout/presentation the following will work.
let config = WKWebViewConfiguration()
if #available(iOS 13.0, *) {
/**
In iOS 13 and above WKWebViews in iPad has the ability to render desktop versions of web pages.
One of the properties they change to support this is the User-Agent.
Therefore forcing the WKWebView to load the mobile version.
*/
let pref = WKWebpagePreferences.init()
pref.preferredContentMode = .mobile
config.defaultWebpagePreferences = pref
}
_webView = WKWebView.init(frame: CGRect.zero, configuration: config)
Topic:
Programming Languages
SubTopic:
Swift
Tags: