title: How to access Array created in closure?
body: <p>I created scheduleDict1 and inserted it into scheduleArray1. I can only get the closure to "see" scheduleArray1 when it is declared in the closure as in the code now. However, I can't access scheduleArray1 anywhere other than the closure.</p>
  
  <p>I have tried declaring the scheduleArray1 in the MainViewController class instead of the closure but it will not be seen inside the closure!</p>
  
  <pre><code>import UIKit
  import Firebase
  
  
  class MainViewController: UITableViewController {
  
    //  var scheduleArray1 = [[String: String]]()
      var scheduleDict = [String: Any]()
  
      override func viewDidLoad() {
          super.viewDidLoad()
          retrieveSchedule()
          }
  
      func retrieveSchedule(){
          let ref = Database.database().reference(withPath: "squadrons/vt-9/2019-04-02/events/")
          ref.observe(.value) { (snapshot) in
              var scheduleArray1 = [[String: String]]()
              var count = 0
              let enumerator = snapshot.children
              while let rest = enumerator.nextObject() {
                  let refToPost = Database.database().reference(withPath: "squadrons/vt-9/2019-04-02/events/" + "\(count)")
                  refToPost.observe(.value, with: { (snapshot) in
              //      let data = snapshot.children
                      let scheduleDict1 = snapshot.value as! [String: String]
                      scheduleArray1.append(scheduleDict1)
  
                    //  self.print(scheduleArray1)
                  })
                  count += 1
              }
          }
  
      }   
  }
  </code></pre>