How to go back to a view controller that wasn't presented without memory leak

I'm trying to back to my initial view controller, but it wasn't presented if the user was already logged in. So, when the user logs out, i want to go back to the initial view controller. i'm currently using a segue, but that would cause a memory leak if used too much. I can't user an unwind segue since the initial view controller was never presented. How would i do this?

Thanks.

Replies

i'm currently using a segue, but that would cause a memory leak if used too much.

That's not clear. How do you know it is a memory leak. It is probably more access to a non existing object. It would be surprising it is due to number of use.

Please show the code where you segue.

  • I think it's a memory leak because the memory keeps going up when I log out, and log back in, since the views keep overlapping.

    This code runs when the logout button is clicked self.performSegue(withIdentifier: "BackToInitial", sender: self)

    Im currently using a replace segue.

  • Is this not a memory leak? I thought that overlapping views could cause that...

Add a Comment