Correct object ownership to remove retain cycle

This commit is contained in:
Maurice Parker 2020-01-30 12:53:27 -07:00
parent 0a3d04ac12
commit ab8deab726
2 changed files with 3 additions and 5 deletions

View File

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

View File

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