However on macOS it is missing one important feature (to me at least) that used to work with WebView:
You can't capture the image of the web browser window any more.
You used to be able to go something like:
NSBitmapImageRep *bitmapdata = [view bitmapImageRepForCachingDisplayInRect: bounds];
[webView cacheDisplayInRect: bounds toBitmapImageRep: bitmapdata];
Or: [NSView cacheDisplayInRect:(NSRect)rect toBitmapImageRep:(NSBitmapImageRep *)bitmapImageRep]
But that's a synchronous API, and since WkWebView runs in another process, it requires a remote procedure call, so Apple simply returns a blank image from that call now.https://stackoverflow.com/questions/31969950/wkwebview-cache...
I think the iOS way of capturing a screen snapshot from WkWebView still works, though, but I can't remember off the top of my head...
However, Apple added a new method to Safari, but last time I checked it was only in the beta Safari and not supported in the version installed on the operating system. (When you make a WkWebView it uses some specific framework that's not necessarily the latest beta version of Safari you've installed.)
//iOS func takeSnapshot(with snapshotConfiguration: WKSnapshotConfiguration?, completionHandler: @escaping (UIImage?, Error?) -> Void)
//macOS func takeSnapshot(with snapshotConfiguration: WKSnapshotConfiguration?, completionHandler: @escaping (NSImage?, Error?) -> Void)
But the problem with this method is that it takes a totally different rendering path ("this is a software painted snapshot"), so some stuff may look different, and WebGL stuff doesn't appear, and it's a whole lot slower than cacheDisplayInRect used to be).
https://stackoverflow.com/questions/46842384/wkwebkit-takesn...
This bug describes the problem and the issues and the less-than-ideal solution:
https://bugs.webkit.org/show_bug.cgi?id=161450
Summary: [Cocoa] No reliable way to get a snapshot of WKWebView