I would like to remove the side grey bars but I do not know how to do it. I tried many solutions like:
self.webView.frame = self.view.bounds
self.webView.scalesPageToFit = true
webView = UIWebView(frame: CGRect(x: 0, y: 0, width: self.view.frame.width, height: self.view.frame.height))
But nothing works...
EDIT: changing in white is better, but I would like to have a real fullscreen webview.
You are testing your project using an iPhone X (or similar), which has top and bottom safe-area margins (or left and right margins in this case because you are using it in landscape mode).
You could use AutoLayout engine to setup your views layout, doing something like this:
NSLayoutConstraint.activate([
self.webView.topAnchor.constraint(equalTo: self.view.topAnchor),
self.webView.rightAnchor.constraint(equalTo: self.view.rightAnchor),
self.webView.bottomAnchor.constraint(equalTo: self.view.bottomAnchor),
self.webView.leftAnchor.constraint(equalTo: self.view.leftAnchor)
]);
Reference to Apple documentation about: "Adaptivity and Layout"