From 91f5d262948c72d05680996a28965853f00fe775 Mon Sep 17 00:00:00 2001 From: "brucehan.xiao" Date: Mon, 8 Aug 2022 17:34:48 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=80=82=E9=85=8Dxcode14?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ios/Classes/Types/UserScript.swift | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ios/Classes/Types/UserScript.swift b/ios/Classes/Types/UserScript.swift index c843e2b8..73544dcb 100644 --- a/ios/Classes/Types/UserScript.swift +++ b/ios/Classes/Types/UserScript.swift @@ -10,9 +10,19 @@ import WebKit public class UserScript : WKUserScript { var groupName: String? - @available(iOS 14.0, *) - lazy var contentWorld: WKContentWorld = WKContentWorld.page + var contentWorldWrapper: Any? + @available(iOS 14.0, *) + var contentWorld: WKContentWorld { + get { + if let value = contentWorldWrapper as? WKContentWorld { + return value + } + return .page + } + set { contentWorldWrapper = newValue } + } + public override init(source: String, injectionTime: WKUserScriptInjectionTime, forMainFrameOnly: Bool) { super.init(source: source, injectionTime: injectionTime, forMainFrameOnly: forMainFrameOnly) } -- Gitee