'How do I programmatically hide or show the button in a scene's view controller that seques to next scene

How do I programmatically hide or show the START SESSION button in a scene's view controller that navigates to the next scene?

enter image description here



Solution 1:[1]

create an outlet to your button in the view controller class:

@IBOutlet weak var startButton: UIButton!

and then in whichever function you want you can show hide it, I assume you want it hidden by default So in view did load you can do

override func viewDidLoad()
{
    startButton.isHidden = true
}

and then show it somewhere else

func doSomethingAndShowButton()
{ 
     // Do some other stuff
     ...

     // Show the button
     startButton.isHidden = false 
}

Solution 2:[2]

@Doug Null To connect the @IBOutlet. First, follow what @AngrayDuck said. After that do as following:

  1. Go to the storyboard.
  2. Open "Connection inspector" on the right side. Can open through shortcut "Command + Option + 7".
  3. Follow the steps highlighted in the below image.

enter image description here

Hope this helps.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 AngryDuck
Solution 2 Abdul Rehman