I need to embed a web inside a MAC executable, so that the html is inside the executable (and not loaded from an external server). It should also be possible to print the contents of the webview.
I have tried with Xcode and Swift, but when printing the webview it looks blank, there are lots of entries in Stack Overflow and seems to be no solution for this in swift.
I have also tried Xojo.com, but the contents are outside the executable visible to the user and must be hidden inside.
Any guidance?
CODE:
import Cocoa
import WebKit
class ViewController: NSViewController {
@IBOutlet weak var WEBVW: WKWebView!
override func viewDidLoad() {
super.viewDidLoad()
if let url = Bundle.main.url ( forResource: "index"
, withExtension: "html"
, subdirectory: "www")
{
let path = url.deletingLastPathComponent();
self.WEBVW.loadFileURL ( url
, allowingReadAccessTo: path);
WEBVW.printView(self)
}
}
}
IMAGE: Program running and printing: https://postimg.cc/Lqsddv1T
Many thanks