0

I was debugging my app using Instruments and found out that every time I perform self.revealViewController().pushViewController() memory usage is increasing. I've changed this line to be self.revealViewController().setFront() and now it looks fine, but I am kinda confused about how it works. What do both of these functions do? How should I navigate if I perform this in didSelectRowAt indexPath method like:

case "MenuText":
    let targetVC = storyboard!.instantiateViewController(withIdentifier: "AllSelectionsNC") as! UINavigationController
    let destinationVC = targetVC.topViewController as! AllSelectionsTableViewController
    self.revealViewController().setFront(targetVC, animated: true)
    self.revealViewController().setFrontViewPosition(.left, animated: true)
    self.setStatusBarStyle(.default)

Am I doing something wrong here? Most of tutorials perform segues using storyboard, but I have to perform them from code

JuicyFruit
  • 2,638
  • 2
  • 18
  • 35
  • 1
    if you are using `setFront` you are replace the VC in visible VC, if you are using push it increase the memory count in stack – Anbu.Karthik Mar 24 '17 at 07:34
  • @Anbu.Karthik so, if what I need is replacing - I should execute `setFront`? – JuicyFruit Mar 24 '17 at 07:35
  • 1
    choice is yours, if your Top VC is the root then use SetFront, else if your current VC is embed in Navigation then use PUSH, once process is completed then use POP for clear the memory , if only u are using the push it increase the memory always if not pop the current VC – Anbu.Karthik Mar 24 '17 at 07:37
  • 1
    in SWL , setFront act like rootviewcontroller, already you know SW_rear (side menu), SW_front (top and visibile VC), SW_right (right menu) – Anbu.Karthik Mar 24 '17 at 07:39
  • @Anbu.Karthik thanks! – JuicyFruit Mar 24 '17 at 07:39

0 Answers0