title: Passing variable in viewDidLoad() or ViewDidAppear() to button action
body: <p>I have a complex variable that I look up from a Firestore Document but that is not important.  It works perfectly in either <code>viewDidLoad</code> or <code>viewDidAppear</code>.  I can print it to verify the variable has the correct value.</p>
  
  <pre><code>let q1 = data!["q1"]! as? Bool ?? true
  </code></pre>
  
  <p>When I call the variable in the <code>if</code> statement in the button action I get the following error:</p>
  
  <blockquote>
    <p>Use of unresolved identifier 'q1'</p>
  </blockquote>
  
  <pre><code>print(q1)
  </code></pre>
  
  <p>But <code>print(q1)</code> works perfectly if run in the <code>viewDidAppear</code>.</p>
  
  <p>Can someone tell me what I am doing wrong?  How can I pass a variable from viewDidLoad to the button action?  </p>