Custom Segues: Basics | raywenderlich.com


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/933383-custom-segues-basics

Hi Josh
Custom segues create memory issues due to previous View Controller still taking memory. Can you make a screencast on how to dismiss the previous view controller after presenting a new View Controller or what is the proper sequence for the segue, dismiss and present or present and dismiss.

@hococoder Can you please help with this when you get a chance? Thank you - much appreciated! :]

Hi Shogunkaramazov & Josh,
Thanks for reaching out. I am trying to say that normally all segues and view controller transition tutorials only talk about presenting the new View Controller, which creates a memory issue as the previous View Controller (or the presenting View Controller) is still a part of the stack and takes up memory. This leads to continuously increasing memory footprints and more often than not is a cause of app crash. If you can please talk about this issue in one of your screencasts it will be highly appreciated. Also, I was asking, in this case, to say what would be better to present a new View Controller and then dismiss the previous View Controller (say using completion handler) or the vice versa.

@guru From what you are saying, the unwind doesn’t clean up?
Do Segues leave a strong ARC reference in their path?
Or is it that you could just have a never ending segue to a next controller and each one leaving an instantiated view controller?

I am just trying to say that segue to a new controller without removing the previous VC leads to memory issue. And for programmatic segues it becomes a bit more challenging as there is no unwind segues.