Skip to main content

Move the WKWebView variable down

ID
a8d90d0
date
2024-05-16 23:21:20+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
19acc20
message
Move the WKWebView variable down
changed files
1 file, 2 additions, 2 deletions

Changed files

save_safari_webarchive.swift (3402) → save_safari_webarchive.swift (3402)

diff --git a/save_safari_webarchive.swift b/save_safari_webarchive.swift
index af634c9..e1b8360 100755
--- a/save_safari_webarchive.swift
+++ b/save_safari_webarchive.swift
@@ -59,8 +59,6 @@ class ExitOnFailureDelegate: NSObject, WKNavigationDelegate {
   }
 }
 
-let webView = WKWebView()
-
 extension WKWebView {
 
   /// Load the given URL in the web view.
@@ -118,6 +116,8 @@ guard CommandLine.arguments.count == 3 else {
 let urlString = CommandLine.arguments[1]
 let savePath = URL(fileURLWithPath: CommandLine.arguments[2])
 
+let webView = WKWebView()
+
 webView.load(urlString)
 webView.saveAsWebArchive(savePath: savePath)