Search code examples
swiftxcodeviewdidload

Xcode Swift ViewDidLoad


I have two ViewControllers. When I press a button on the FirstViewController the SecondViewController shows up. When I press a button on the SecondViewController the FirstViewController shows up again. The problem is, that the View on the FirstViewController does not load again. The ViewDidLoad loop does not load again. I want to create a loop, which checks a variable every single time the FirstViewController shows up.


Solution

  • Put that code in viewDidAppear or viewWillAppear.