Created
June 19, 2023 15:45
-
-
Save Bahallack/1ccb92d4a5efe1241f8edc0ee73dfab4 to your computer and use it in GitHub Desktop.
loadWebArchive
This file contains 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 characters
func loadWebArchive(named name: String, into webView: WKWebView) { | |
let fileURL = self.webArchiveDirectoryURL.appendingPathComponent("\(name).webarchive") | |
do { | |
let archiveData = try Data(contentsOf: fileURL) | |
webView.load(archiveData, mimeType: "application/x-webarchive", characterEncodingName: "", baseURL: fileURL) | |
print("Web archive loaded from: \(fileURL.path)") | |
} catch { | |
print("Error loading web archive: \(error.localizedDescription)") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment