There is a webview in the app and a "Save" button on top of the webview.
After clicking the "Save" button currenturl will be saved to a TableView on another ViewController. Everything works fine.
Now I would like to also save the web page as PDF to the same TableView and can open it after clicking. How can I do that?
The following is codes for saving currenturl. savedURLs is the array to save all urls on another ViewController.
import UIKit
class BrowserViewController: UIViewController {
@IBOutlet weak var browser: UIWebView!
@IBAction func saveButtonPressed(sender: AnyObject) {
if let currentURL = browser.request?.URL?.absoluteString {
savedURLs.append(currentURL)
NSUserDefaults.standardUserDefaults().setObject(currentURL, forKey: "currenturl")
NSUserDefaults.standardUserDefaults().setObject(savedURLs, forKey: "savedURLs")
self.performSegueWithIdentifier("toSavingVC", sender: self)
}
}