From 06f87e81c4f55b7b251a149ec0db60442bb351c3 Mon Sep 17 00:00:00 2001 From: CodeEagle Date: Wed, 29 Jun 2022 14:51:45 +0800 Subject: [PATCH] change: fixed Xcode 14 build error --- ios/Classes/Types/UserScript.swift | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ios/Classes/Types/UserScript.swift b/ios/Classes/Types/UserScript.swift index c843e2b..fe5a051 100644 --- a/ios/Classes/Types/UserScript.swift +++ b/ios/Classes/Types/UserScript.swift @@ -10,8 +10,19 @@ import WebKit public class UserScript : WKUserScript { var groupName: String? + + var contentWorldWrapper: Any? @available(iOS 14.0, *) - lazy var contentWorld: WKContentWorld = WKContentWorld.page + 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)