I am removing viewController from controller hierarchy with removeFromParentViewController
, but deinit
of view controller not get called. How can I check what holds strong reference on it?
Any way to see reference graph exist in memory?
This is how my swap` method looks like:
public class func swap(fromViewController: UIViewController!, toViewController: UIViewController!, containerViewController: UIViewController!) {
fromViewController.willMoveToParentViewController(nil)
containerViewController.addChildViewController(toViewController)
toViewController.view.frame = containerViewController.view.bounds
containerViewController.transitionFromViewController(fromViewController, toViewController: toViewController, duration: 0.2, options: UIViewAnimationOptions.TransitionCrossDissolve, animations: {}, completion: {finished in
fromViewController.removeFromParentViewController()
toViewController.didMoveToParentViewController(containerViewController)
})
}
In transitionFromViewController
completion
should I add / remove destination / source views?
Any way to access refCount
of a viewController
in Swift?
I tried to analyse code with Instruments
. Figure out what hold strong reference to view controller, but couldn't figure out. Any help?
You can use profile the code with Instruments. In Xcode, select Product > Profile. When Instruments loads, select Allocations as the template.
This will allow you to trace which objects are setting what strong references.