-1

I made a webview app but, I can't pull to refresh. How can I do? This is my code.

override func viewDidLoad() {
    super.viewDidLoad()
    let url = URL(string: "http://www.vicco.com.tr/report/")
    let request = URLRequest(url: url!)
    viewTwo.loadRequest(request);
}
LC 웃
  • 18,888
  • 9
  • 57
  • 72
  • Related https://stackoverflow.com/questions/38156954/pull-to-refresh-not-working-in-ios-webview/ – Nirav D Jun 13 '17 at 11:31
  • This link may you help. https://stackoverflow.com/questions/36256448/how-do-i-add-pull-to-refresh-in-webview – Aashish Jun 13 '17 at 11:31

1 Answers1

1
Please try this for swift

 override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.

        let refreshControl = UIRefreshControl()
        refreshControl.addTarget(self, action: #selector(refreshWebView), for: UIControlEvents.valueChanged)
        webViewPDF.scrollView.addSubview(refreshControl)
    }

    func refreshWebView(sender: UIRefreshControl) {
        print("refersh")
        self.webViewPDF.loadRequest(URLRequest(url: URL(string: "https://google.com")!))
        sender.endRefreshing()
    }
Kamal Thakur
  • 398
  • 2
  • 8