Generate .webarchive on a WKWebView

Is there any way to generate a .webarchive from iOS? I know that WKWebView can render them without any issues (generated them on macOS for example), but it seems that there's no API to generate one from iOS itself.

It seems that not so long ago such feature became available on WebKit, but it's not yet available to the public API of WKWebView: https://github.com/WebKit/webkit/commit/7bc9562269dacab6b75833e3d00be3c4f616bfd4

Would Apple consider making such API public? I'm assuming that it's what's being used on the Reading List to save articles offline.
Answered by xmollv in 620500022
createWebArchiveData is available in Beta 2, and it seems to do exactly what I needed. Kudos to the team! 👏

Link to the docs: https://developer.apple.com/documentation/webkit/wkwebview/3650491-createwebarchivedata

Would Apple consider making such API public?

You should watch "Discover WKWebView Enhancements" on Thursday.

 I'm assuming that it's what's being used on the Reading List to save articles offline.

Don't necessarily assume things ;)
Thanks a lot for the reply, I'm eager to watch the session! 🙌
It's also possible to use Web Inspector to download a .webarchive by remotely inspecting the WKWebView on the iOS device and clicking on the download button in the left side of the tab bar :)
It seems that "Discover WKWebView Enhancements" introduced exactly what I needed. I haven't had time to give it a try yet, but it looks exactly like what I was looking for. Thank you so much! 💖

Edit: I went to give it a try and it doesn't seem to be available in Beta 1.

Value of type 'WKWebView' has no member 'createWebArchiveData'

🤞 for Beta 2!


Accepted Answer
createWebArchiveData is available in Beta 2, and it seems to do exactly what I needed. Kudos to the team! 👏

Link to the docs: https://developer.apple.com/documentation/webkit/wkwebview/3650491-createwebarchivedata
Generate .webarchive on a WKWebView
 
 
Q