I have several UIViewController
s which are added to a content view. After calling my remove function, I'm noticing that the child UIViewController
's deinit
function is not being called unless I explicitly set the value of the child UIViewController
to nil
.
Is that the proper behavior or am I doing something wrong?
func removeViewController(fromCell cell:UICollectionViewCell, at indexPath:IndexPath){
guard let childViewController = currentViewControllers[indexPath] else { return }
print("remove view controller called")
childViewController.willMove(toParent: nil)
childViewController.view.removeFromSuperview()
childViewController.removeFromParent()
currentViewControllers[indexPath] = nil
// recycledViewControllers.insert(childViewController)
}