title: Capture information from FIREBASE nested child node into an array and pass it to next ViewController XCODE
body: <p><a href="https://i.stack.imgur.com/0ItNB.jpg" rel="nofollow noreferrer">FIREBASE image of JSON tree with nested QUESTIONS</a>  </p>
  
  <pre><code>func loadTitles(){
  
      databaseHandle = ref?.child("Titles").observe(.childAdded) { (snapshot: DataSnapshot) in
  
          if let dict = snapshot.value as? [String: Any]{
  
              let titleName = dict["Name"] as! String
              let directorName = dict["Director"] as! String
              let releaseDate = dict["Release"] as! String
              let titleImage = dict["TitleImage"] as? String
              let titleRating = dict["Rating"] as? Int
  
              let title = Title(titleName: titleName, titleImage: titleImage, directorName: directorName, releaseDate: releaseDate, titleRating: titleRating)
  
              self.Titles.append(title)
              self.tableView.reloadData()
          }
      }
  }
  </code></pre>
  
  <p>This code is how I am modelling initial JSON grab from Database. This all works fine in tableview. It also has a child that contains many questions. See image for example. <a href="https://i.stack.imgur.com/0ItNB.jpg" rel="nofollow noreferrer">enter image description here</a>I am making a trivia game. Simple enough.</p>
  
  <p>Using XCODE 9, Swift 4 and FIREBASE. </p>
  
  <p>Everything was working with hardcoded data but since switching to FIREBASE I have been having trouble getting it all to function as it was.</p>
  
  <p>My current issue is utilising different aspects of the same snapshot on various screens as a user navigates.</p>
  
  <p>I have researched this and only half my issue is resolved. I know how to capture a snapshot from FIREBASE but what I want to actually do is the following:</p>
  
  <ol>
  <li><p>I have a child called TITLE and within it I have values for the details of the title. Each TITLE has a child called QUESTIONBANK which then contains multiple QUESTION children that each have values: Question, Answer, Answer, Answer etc for each. Thus a TITLE can have MANY questions and each QUESTION has its own set of answers.</p></li>
  <li><p>On a table view I grab the TITLES via snapshot and display them. All working fine. I push it to an array and use a model for TITLE to display them dynamically. I also set up a cache helper to allow it to be saved during a session as users go back and forth. </p></li>
  </ol>
  
  <p>ISSUE!</p>
  
  <ol start="3">
  <li>I want to then allow a user to tap on a cell and travel to the actual trivia section and utilise the questions within the QUESTION BANK child of the specific TITLE. ie creating an array of questions with answers on the NEXT page using the title chosen as the reference for the QUESTION BANK node to use that is specific to that title.</li>
  </ol>
  
  <p>The problem is once I have used the snapshot for the TITLE on one page, I am not able to then go back in and create an array of all the questions and answers for that TITLE when it is selected by the user and we move to another page.</p>
  
  <p>I already created the model for this and I know it works as I hardcoded data for it BEFORE setting up FIREBASE and replacing all my hardcoded data with FIREBASE database, storage and authentication.</p>
  
  <p>It has been a struggle as I am very new to all this and I now hit a wall with this latest matter. I don't want to spend days or a week trying to figure it out.</p>
  
  <p>Any help appreciated on it!</p>