Created
July 22, 2020 15:26
-
-
Save vinbrule/fdce5cf7e221f34d2e400bfada502438 to your computer and use it in GitHub Desktop.
Revisions
-
vinbrule created this gist
Jul 22, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ import AppKit import PlaygroundSupport import WebKit var webView: WKWebView! webView = WKWebView(frame: CGRect(x: 0, y: 0, width: 600, height: 800.0)) var filePath = URL.init(fileURLWithPath: "/Users/van/Downloads/firefox/01-interview preparation/leetcode/facebook/Longest Substring Without Repeating Characters - LeetCode Articles.webarchive") print(filePath) let fileDirectoryURL = filePath.deletingLastPathComponent() webView.loadFileURL(filePath, allowingReadAccessTo: fileDirectoryURL) //if let url = URL(string: "https://www.apple.com") { // let request = URLRequest(url: url) // webView.load(request) //} let nibFile = NSNib.Name("MyView") var topLevelObjects : NSArray? Bundle.main.loadNibNamed(nibFile, owner:nil, topLevelObjects: &topLevelObjects) let views = (topLevelObjects as! Array<Any>).filter { $0 is NSView } // Present the view in Playground PlaygroundPage.current.liveView = webView//views[0] as! NSView