Open d2vydov opened 4 years ago
I'm not sure I understand what you mean - can you elaborate on how adding another protocol will solve memory issues? A method would need to be called at some point - that cannot easily be done. An alternative would be to enable overriding of canBeRemovedAsChild
. Feel free to open a MR once you have a working version, so we can start a discussion on how to solve this best.
The leak in AboutCoordinator can easily be fixed by overriding the viewController
property with:
override var viewController: UIViewController! {
rootViewController.viewControllers.first { $0 is AboutViewController }
}
I will open a MR today for that.
Me too. Even build with XCoordinator v2.2.0, the child coordinator can't be removed when clicked the navigation bar back button. I have tried the way from @pauljohanneskraft , it works.
there is a memory leak with
AboutCoordinator
- it is added as a child intoUserListCoordinator
@pauljohanneskraft we discussed this with you in slack and you adviced to
removeChild
or overrideviewController
for fix cycle.but I see a little problem, if we have a lot of coordinations in a child coordinator, override a
viewController
is not a good solution I guess.removeChild
decision isn't simple - we should notify coordinator from view (viewController) about we should free coordinator (if user tapped to back button) and handle some transitions which throw out from its coordinator. and then we should remove parent when transitions has been success.the both solutions are far from perfect, right?
I have a proposal, what do you think about
CoordinatorAutoreleasable
protocol with some method which takes some view controller notifies a main controller of this flow - like root controller, just not root. Ideally, of course, it will be perfect if we will be able to inherit some coordinator from this protocol and it will be deallocated automatically :)