I am currently running an application with a MenuVC allowing users to pick their choice of four segues to present other VC's. When these four buttons/segues are triggered, a new VC is presented by method of showing. To deal with the problem of constantly increasing the memory usage because the VC's are being placed on top of each other, I have attempted to dismiss VC's in the segues as new VC's are being presented. The problem is, this logic does not work with my application, because the non Menu VC's can trigger segues to each other, thus creating problems with which VC is exactly shown after dismissal (Menu can show Records, and Records can show Options, causing issues with what VC is supposed to be on top).
I was wondering if there is a way to solve the issue of dismissing the VC's to free up memory without the implementation of a NavigationControllers as I have already progressed this far not using them.
For reference here is how I am presenting/dismissing each VC.
@IBAction func moveToOptions(_ sender: Any) {
self.dismiss(animated: true, completion: nil)
self.performSegue(withIdentifier: "toOptionsSegue", sender: nil)
AVAudioPlayer.playSpecAudio(audioPiece: "Click", volume: 0.7)
}
Thank you.