I'm creating a macOS SwiftUI app that opens a WKWebView to a specific URL.
Now I'm attempting to make a MenuItem mapped to a function that takes a screenshot of the WKWebView window, and saves it to ~/Pictures with a timestamp.
I tried to look for this via tutorials but only found iOS WKSnapShot type stuff.
While the "MenuItem" -> bind to -> First Responder -> @IBAction
is something I'm kind of familiar with now, I'm not entirely sure how to call the WKWebView snapshotting and how to define it's timestamped name.
@IBAction func takeSnapshot(with snapshotConfiguration: WKSnapshotConfiguration?,
completionHandler: @escaping (NSImage?, Error?) -> Void)
{
}
This started shooting errors at me: @IBAction methods must have 1 argument