change: fixed Xcode 14 build error

This commit is contained in:
CodeEagle 2022-06-29 14:51:45 +08:00
parent ee1b0d7ff7
commit 06f87e81c4
1 changed files with 12 additions and 1 deletions

View File

@ -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)