Skip to content

Instantly share code, notes, and snippets.

@nderkach
Created December 3, 2017 16:09
Show Gist options
  • Select an option

  • Save nderkach/8e4e99a18a446f4e3c62bbbf42c80990 to your computer and use it in GitHub Desktop.

Select an option

Save nderkach/8e4e99a18a446f4e3c62bbbf42c80990 to your computer and use it in GitHub Desktop.
func updateLocation(_ location: CLLocation) {
if let uid = Auth.auth().currentUser?.uid {
let latitude = location.coordinate.latitude + (Double(arc4random()) / Double(UINT32_MAX) / 10 - 0.05)
let longitude = location.coordinate.longitude + (Double(arc4random()) / Double(UINT32_MAX) / 10 - 0.05)
self.ref.child("users/\(uid)/location").setValue(["lat": latitude, "lon": longitude])
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment