From the storyboard diagram, itβs clear that you created a session from each button in the βtab barβ to another view controller. With the exception of unwinding segue, segues always create a new instance of the view controller to which they switch. Therefore, if you use your setting to switch from view controller 1 to view controller 2, and then back to view controller 1, you will not return to the view controller from which you came, but instead you will create a completely new controller of type 1 .
This is why memory consumption is excessive. You continue to create view controllers until your application runs.
I would recommend that you return to using the tab bar controller. They were designed to distribute view controllers at once, and then simply switch between them. In addition, they have a standard view of the reason; it helps the user of your application to immediately learn how to interact with them.
To transfer data between tabs, you will not use segues, because when you switch tabs, there are no changes. There are many ways to do this, but they all boil down to having model data stored where all the tabs can access it. This can be done using CoreData in a larger application. For a simple application, you can do the following:
Create your own subclass of UITabBarController . Let me call it CustomTabBarController . Ask this class to create and hold model data to which all your tabs will be accessible.
CustomTabBarController.swift:
import UIKit
In your storyboard, in the Identity Inspector, change the UITabBarController class to CustomTabBarController .

In viewWillAppear in each of your tabs you will get a link to the model data, and then you can use it.
FirstViewController.swift:
import UIKit class FirstViewController: UIViewController { override func viewWillAppear(animated: Bool) {
SecondViewController.swift:
import UIKit class SecondViewController: UIViewController { @IBOutlet weak var nameLabel: UILabel! @IBOutlet weak var ageLabel: UILabel! override func viewWillAppear(animated: Bool) {
source share