This repository was archived by the owner on Apr 11, 2020. It is now read-only.
This repository was archived by the owner on Apr 11, 2020. It is now read-only.
Open
Description
Like with all the other examples and yours, setting the view controller as the delegate to the navigation controller delegate property breaks your closure link responsible for deallocating the child coordinator.
To reproduce, replace this code block into the ProfileCoordinator.swift
file and toggle on and off the setting of the navigation controller delegate property in the ProfileCoordinator
class to see it in action.
class ProfileViewController: UIViewController, UINavigationControllerDelegate {
deinit {
print("deinitialised")
}
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = UIColor.red
//Toggle this line on and off as a comment to see that this view controller is never deinitialised.
self.navigationController?.delegate = self
}
}
class ProfileCoordinator: Coordinator<DeepLink> {
let viewController = ProfileViewController()
private let store: StoreType
init(router: RouterType, store: StoreType) {
self.store = store
super.init(router: router)
}
// We must override toPresentable() so it doesn't
// default to the router's navigationController
override func toPresentable() -> UIViewController {
return viewController
}
}
Metadata
Metadata
Assignees
Labels
No labels