title: Metal API Validation Enabled Location Swift
body: <p>I'm using the location display feature.</p>
  
  <p>When I install the application on the phone with Xcode works fine.</p>
  
  <p>But when I use the application without installing the application with Xcode, it throws from the application does not show the location.</p>
  
  <p>What is the problem? I get the output when running with Xcode:</p>
  
  <blockquote>
    <p>Metal API Validation Enabled</p>
  </blockquote>
  
  <pre><code>import Foundation
  import CoreLocation
  import UIKit
  
  public extension CLLocation {
    func bearingToLocationRadian(_ destinationLocation: CLLocation) -&gt; CGFloat {
  
      let latitud1 = self.coordinate.latitude.degreesToRadians
      let lon1 = self.coordinate.longitude.degreesToRadians
  
      let latitud2 = destinationLocation.coordinate.latitude.degreesToRadians
      let lon2 = destinationLocation.coordinate.longitude.degreesToRadians
  
      let dLon = lon2 - lon1
  
      let y = sin(dLon) * cos(latitud2)
      let x = cos(latitud1) * sin(latitud2) - sin(latitud1) * cos(latitud2) * cos(dLon)
      let radiansBearing = atan2(y, x)
  
      return CGFloat(radiansBearing)
    }
  
    func bearingToLocationDegrees(destinationLocation: CLLocation) -&gt; CGFloat {
      return bearingToLocationRadian(destinationLocation).radiansToDegrees
    }
  }
  
  extension CGFloat {
    var degreesToRadians: CGFloat { return self * .pi / 180 }
    var radiansToDegrees: CGFloat { return self * 180 / .pi }
  }
  
  private extension Double {
    var degreesToRadians: Double { return Double(CGFloat(self).degreesToRadians) }
    var radiansToDegrees: Double { return Double(CGFloat(self).radiansToDegrees) }
  }
  </code></pre>