swiftuiwebviewuiprintformatter

UIMarkupTextPrintFormatter for UiWebView


I'm searching how to print the current page in the UiWebView . I got this :

let formatter = UIMarkupTextPrintFormatter(markupText: SearchBar.text)

I don't find what I need to write instead of the SearchBar.text for printing the Web page.


Solution

  • Instead of using a UIMarkupTextPrintFormatter you can get a UIViewPrintFormatter right from the web view itself:

    let formatter = myWebView.viewPrintFormatter()
    

    More here on NSHipster.