title: Reverse geocoding in Swift 4
body: <p>I'm attempting to write a simple method that's fed <code>CLLocationDegrees</code> and returns a <code>CLPlacemark</code>. Looking at <a href="https://developer.apple.com/documentation/corelocation/clgeocoder/1423621-reversegeocodelocation#" rel="nofollow noreferrer">Apple's documentation</a>, it seems like a simple task.</p>
  <p>Below is what I've dumped into a playground:</p>
  <pre><code>import CoreLocation
  // this is necessary for async code in a playground
  import PlaygroundSupport 
  // this is necessary for async code in a playground
  PlaygroundPage.current.needsIndefiniteExecution = true
  
  func geocode(latitude: CLLocationDegrees, longitude: CLLocationDegrees) -&gt; CLPlacemark? {
      let location = CLLocation(latitude: latitude, longitude: longitude)
      let geocoder = CLGeocoder()
      var placemark: CLPlacemark?
      geocoder.reverseGeocodeLocation(location) { (placemarks, error) in
          if error != nil {
              print(&quot;something went horribly wrong&quot;)
          }
          if let placemarks = placemarks {
              placemark = placemarks.first
          }
      }
      return placemark
  }
  let myPlacemark = geocode(latitude: 37.3318, longitude: 122.0312)
  </code></pre>
  <hr />
  <p>As it stands, my method is returning nil. I'm not sure where my error lies, but I rest assured it's something starlingly stupid on my part. Thank you for reading.</p>