title: How retrieve values from an object on Cloud Firestore? Swift
body: <p>I'm quite new on <code>Firestore</code> and <code>Firebase</code> libraries. Can someone explain how could I retrieve the fields from my <code>object</code> and stored in a variable on my code? I'm trying to access all the <code>latMin</code>, <code>latMax</code>, <code>lonMin</code>, and <code>lonMax</code> from each object in my Firestore, as well if is a way to retrieve each field with the same name (ex. <code>latMin</code> from place 1 and 2). I don't know if this is possible or maybe there is a better way to have organized my <code>Firebase</code>.</p>
  
  <p>Here is my Cloud Firebase: <a href="https://i.stack.imgur.com/XvB1d.png" rel="noreferrer">Here is the image for my Firestore, requested in the comments.</a></p>
  
  <pre><code>place 1:  //This is an Object in my Firestore
  
    //Field = Number : Value ----&gt; This is how object is orginazed 
  
    latMax : 39.727
    latMin : 39.726
    lonMax : -121.7997
    lonMin : -121.8003
  
  place 2: 
  
    latMax : 39.7559
    latMin : 39.755
    lonMax : -122.1988
    lonMin : -122.1992
  </code></pre>
  
  <p>I was able to access the objects without any problem, this is the function I'm using to read the documents on my Firestore: </p>
  
  <pre><code>import UIKit
  import FirebaseFirestore
  import Firebase
  import CoreLocation
  
  class SecondViewController: UIViewController, CLLocationManagerDelegate {
  
  //Creating access to locationManager
  var locationManager : CLLocationManager!
  
  @IBOutlet weak var latLabel: UILabel!
  @IBOutlet weak var lonLabel: UILabel!
  @IBOutlet weak var place: UILabel!
  @IBOutlet weak var placeImage: UIImageView!
  
  
  //Storing the pass data that we got from the firt View
  var lonStore = String()
  var latStore = String()
  var fireLon = String()
  var fireLat = String()
  var lonNumberStore = Double()
  var latNumberStore = Double()
  var fireLonMax = Double()
  var fireLatMax = Double()
  var fireLonMin = Double()
  var fireLatMin = Double()
  
  
  override func viewDidLoad() {
  
  
      //Here goes some code to display on the SecondViewController
      readArray()
  
  }
  
  func readArray() {
  
      let placeRef = Firestore.firestore().collection("places")
          placeRef.getDocuments { (snapshot, error) in
          guard let snapshot = snapshot else {
              print("Error \(error!)")
              return
          }
          for document in snapshot.documents {
              let documentId = document.documentID
              let latMax = document.get("latMax") as! String //Getting a nil error
              print(documentId, latMax) //This print all objects
  
          }
      }
  }
  </code></pre>
  
  <p>I'm missing something and I know it, the problem is that I can't find any reference of what I need to do in this case, I had read the documentation like 50 times and I can't find the solution. Thanks for taking the time to read my post.</p>