title: How to avoid calling viewDidLoad() to refresh the view
body: <p>I am using swipe gesture to change the appearance of the main view:</p>
  
  <pre><code>@IBAction func changeSeqBack(_ recognizer: UISwipeGestureRecognizer) {
  
          if (recognizer.direction == UISwipeGestureRecognizerDirection.right) {
              count = 0
              if timerIndex % 5 == 0 {
                  timerIndex -= 5
                  initialState -= 1
                  viewDidLoad()
              } else {
                  while timerIndex % 5 != 0 {
                      timerIndex -= 1
                      if timerIndex % 5 == 0 {
                          count = 0
                          initialState -= 0
                          viewDidLoad()
                      } 
                  }
              }
          }
      } 
  </code></pre>
  
  <p>The <code>initialState</code> variable, as it is changed with swipes, calls a number of methods which hide or show various objects on the screen. The problem is that I can only make the changes appear is calling viewDidLoad() after every swipe. That seems to be bad practice as it loads the memory. Is there any other approach to make it easy on the memory?</p>