title: How to extract street, city, etc. from GMSPlace Address Components
body: <p>I'm using Google Places API for iOS and can successfully retrieve nearby places and present the address as a string.  What I'm trying to do is extract address components such as city to store in a database.</p>
  
  <p>The documentation indicates a GMSPlace has an addressComponents property (an array), but I can't seem to figure how to use this property.  </p>
  
  <p>The code below provides sets the entire address to the text of a label, but I can't get beyond that:</p>
  
  <p>Edit ---- added code that shows how I'm trying to access Address Components</p>
  
  <pre><code>venueLabel.isHidden = false
              venueLabel.text = selectedPlace?.name
              addressLabel.isHidden = false
              addressLabel.text = selectedPlace?.formattedAddress
              let addressComponents = selectedPlace?.addressComponents
              for component in addressComponents! {
                  let city = component["city"] //Error Type GMSPaceAddressComponent has no subscript members
                  print(city)
              }
  </code></pre>