Correct object ownership to remove retain cycle
This commit is contained in:
parent
0a3d04ac12
commit
ab8deab726
|
@ -12,7 +12,7 @@ import Articles
|
|||
|
||||
class ArticleIconSchemeHandler: NSObject, WKURLSchemeHandler {
|
||||
|
||||
let coordinator: SceneCoordinator
|
||||
weak var coordinator: SceneCoordinator?
|
||||
|
||||
init(coordinator: SceneCoordinator) {
|
||||
self.coordinator = coordinator
|
||||
|
@ -20,7 +20,7 @@ class ArticleIconSchemeHandler: NSObject, WKURLSchemeHandler {
|
|||
|
||||
func webView(_ webView: WKWebView, start urlSchemeTask: WKURLSchemeTask) {
|
||||
|
||||
guard let url = urlSchemeTask.request.url else {
|
||||
guard let url = urlSchemeTask.request.url, let coordinator = coordinator else {
|
||||
urlSchemeTask.didFailWithError(URLError(.fileDoesNotExist))
|
||||
return
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ import WebKit
|
|||
class WebViewProvider: NSObject, WKNavigationDelegate {
|
||||
|
||||
let articleIconSchemeHandler: ArticleIconSchemeHandler
|
||||
let viewController: UIViewController
|
||||
|
||||
private let minimumQueueDepth = 3
|
||||
private let maximumQueueDepth = 6
|
||||
|
@ -25,9 +24,8 @@ class WebViewProvider: NSObject, WKNavigationDelegate {
|
|||
|
||||
init(coordinator: SceneCoordinator, viewController: UIViewController) {
|
||||
articleIconSchemeHandler = ArticleIconSchemeHandler(coordinator: coordinator)
|
||||
self.viewController = viewController
|
||||
super.init()
|
||||
self.viewController.view.insertSubview(queue, at: 0)
|
||||
viewController.view.insertSubview(queue, at: 0)
|
||||
replenishQueueIfNeeded()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue