CopyPastor

Detecting plagiarism made easy.

Score: -1; Reported for: Open both answers

Possible Plagiarism

Plagiarized on 2018-02-02
by Rawand Ahmed Shaswar

Original Post

Original - Posted on 2017-12-28
by Jack



            
Present in both answers; Present only in the new answer; Present only in the old answer;

There’s dozens of questions related to yours on SO. ———- In **Swift 4+** and **Xcode 9** Method 1: using `UIDocumentInteractionController` 1- Add the `UIDocumentInteractionControllerDelegate`,`WKNavigationDelegate` let documentInteractionController = UIDocumentInteractionController(url: URL(fileURLWithPath: path)) documentInteractionController.delegate = self documentInteractionController.presentPreview(animated: true) And the delegate: //MARK: UIDocumentInteractionController delegates func documentInteractionControllerViewControllerForPreview(_ controller: UIDocumentInteractionController) -> UIViewController { return self } **OR** Method 2: Using `UIWebView` let webview = WKWebView(frame: UIScreen.main.bounds) view.addSubview(webview) webview.navigationDelegate = self webview.load(URLRequest(url: URL(fileURLWithPath: path)))//URL(string: "http://") for web URL C: Jack
***SWIFT 4+***
*If has to open file from local cache/Documentdiectory which has file path*
**Method 1: using UIDocumentInteractionController**
class ViewController: UIViewController,UIDocumentInteractionControllerDelegate,WKNavigationDelegate { let documentInteractionController = UIDocumentInteractionController(url: URL(fileURLWithPath: path)) documentInteractionController.delegate = self documentInteractionController.presentPreview(animated: true) } //MARK: UIDocumentInteractionController delegates func documentInteractionControllerViewControllerForPreview(_ controller: UIDocumentInteractionController) -> UIViewController { return self } **Method 2: using WebView**
let webview = WKWebView(frame: UIScreen.main.bounds) view.addSubview(webview) webview.navigationDelegate = self webview.load(URLRequest(url: URL(fileURLWithPath: path)))//URL(string: "http://") for web URL

        
Present in both answers; Present only in the new answer; Present only in the old answer;