title: How to create global variable in Swift?
body: <p>I am trying to set a global variable. In my case, just a boolean flag that indicates if a view is being presented for the first time:</p>
  
  <pre><code>var initialLoadFlag: Bool = true
  </code></pre>
  
  <p>After the view is presented, I want to set this flag to false:</p>
  
  <pre><code>var initialLoadFlag: Bool = false
  </code></pre>
  
  <p>And then check for it thenceforth:</p>
  
  <pre><code>if initialLoadFlag {
     showWelcomeMessage() 
  }
  </code></pre>
  
  <p>So, I would like to create <code>initialLoadFlag</code> as a global variable. Where and how? I've tried:</p>
  
  <ul>
  <li>In the <code>viewDidLoad</code> area of my view controller</li>
  <li>In the <code>application()</code> method in my AppDelegate.swift file</li>
  <li>In the <code>AppDelegate</code> class</li>
  </ul>
  
  <p>No luck. I'm getting a <code>Use of unresolved identifier 'initialLoadFlag'</code> error message</p>
  
  <p>(Note: I realize that in this question I betray my ignorance of how scope is handled in Swift. Please forgive me... I'm on a deadline, and still new to the language.)</p>
  
  <p>Thanks for your help.</p>