This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// HostingNode.swift | |
// | |
import AsyncDisplayKit | |
import SwiftUI | |
class HostingNode: ASDisplayNode { | |
var viewController: UIViewController? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let userScript = WKUserScript(source: source, | |
injectionTime: .atDocumentEnd, | |
forMainFrameOnly: true) | |
let userContentController = WKUserContentController() | |
userContentController.addUserScript(userScript) | |
let configuration = WKWebViewConfiguration() | |
configuration.userContentController = userContentController |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return configure(WKWebView( | |
frame: .zero, | |
configuration: configure(WKWebViewConfiguration()) { | |
$0.userContentController = configure(WKUserContentController()) { | |
$0.addUserScript( | |
WKUserScript( | |
source: source, | |
injectionTime: .atDocumentEnd, | |
forMainFrameOnly: true | |
) |