and example for UIWebView state restoration in swift. Use WKWebView when possible, though.