Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import UIKit
import WebKit
class MagazineViewController: UIViewController, UIWebViewDelegate {
@IBOutlet weak var webview: UIWebView!
override func viewDidLoad() {
// TODO replace URL here
let url = URL(string: "")
webview.loadRequest(URLRequest(url: url!))
override func didReceiveMemoryWarning() {
func webViewDidStartLoad(_ webView: UIWebView) {
if webview.canGoBack {
self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "BACK", style: UIBarButtonItemStyle.plain, target: self, action: #selector(goBack))
} else {
self.navigationItem.leftBarButtonItem = nil
@objc func goBack() {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.