From 5addbc6eb609e0523cbf0b3893fd9243d8e2846b Mon Sep 17 00:00:00 2001 From: Michael Diente Date: Thu, 21 May 2020 23:19:48 +0800 Subject: [PATCH] Save all retrieved cookies and get cookies using javascript --- WKCookieWebView/WKCookieWebView.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/WKCookieWebView/WKCookieWebView.swift b/WKCookieWebView/WKCookieWebView.swift index 97f2185..017e22c 100644 --- a/WKCookieWebView/WKCookieWebView.swift +++ b/WKCookieWebView/WKCookieWebView.swift @@ -58,6 +58,10 @@ open class WKCookieWebView: WKWebView { return super.load(request) } + @objc public func deleteRecordedCookie(_ cookie: HTTPCookie) { + recordedCookies.removeAll(where: { $0.name == cookie.name }) + } + // MARK: - Private private func userContentWithCookies(_ url: URL) -> WKUserContentController { let userContentController = configuration.userContentController