mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Merge pull request #246 from omnivore-app/fix/process-pool
Use a single process pool for all webviews
This commit is contained in:
commit
0e1690d9f5
1 changed files with 22 additions and 1 deletions
|
|
@ -5,6 +5,27 @@ import WebKit
|
|||
|
||||
public let readerViewNavBarHeight = 50.0
|
||||
|
||||
enum WebViewConfigurationManager {
|
||||
private static let processPool = WKProcessPool()
|
||||
static func create() -> WKWebViewConfiguration {
|
||||
let config = WKWebViewConfiguration()
|
||||
config.processPool = processPool
|
||||
// config.limitsNavigationsToAppBoundDomains = true
|
||||
return config
|
||||
}
|
||||
}
|
||||
|
||||
enum WebViewManager {
|
||||
public static let sharedView = create()
|
||||
public static func shared() -> WebView {
|
||||
sharedView
|
||||
}
|
||||
|
||||
public static func create() -> WebView {
|
||||
WebView(frame: CGRect.zero, configuration: WebViewConfigurationManager.create())
|
||||
}
|
||||
}
|
||||
|
||||
#if os(iOS)
|
||||
struct WebAppView: UIViewRepresentable {
|
||||
let request: URLRequest
|
||||
|
|
@ -28,7 +49,7 @@ public let readerViewNavBarHeight = 50.0
|
|||
}
|
||||
|
||||
func makeUIView(context: Context) -> WKWebView {
|
||||
let webView = WebView(frame: CGRect.zero)
|
||||
let webView = WebViewManager.create()
|
||||
let contentController = WKUserContentController()
|
||||
|
||||
webView.navigationDelegate = context.coordinator
|
||||
|
|
|
|||
Loading…
Reference in a new issue