Preview:
// Get user's GPS coordinates
    func getUserCoordinates(){
        if let coordinates = locationManager.location?.coordinate{
            print("Latitude: \(coordinates.latitude), Longitude: \(coordinates.longitude)")
            
            // Implement network request passing in user's coordinates
            DispatchQueue.main.async {
                // Setup UI
            }
        } else {
            // print "unable to get coordinates
        }
    }
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter